diff --git a/new-lamassu-admin/README.md b/new-lamassu-admin/README.md index e44a779e..4cb9efc2 100644 --- a/new-lamassu-admin/README.md +++ b/new-lamassu-admin/README.md @@ -1,5 +1,3 @@ -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). - ## Dev Environment ### formatting @@ -10,11 +8,6 @@ The configuration for vscode is already on the repo, all you need to do is insta This project has a husky pre commit hook to format the staged changes using our styleguide. To take advantage of that make sure to run `git commit` from within this folder. -### Sanctuary - -Sanctuary has a runtime typechecker that can make be quite slow, but its turned off by default. - -To turn it on add the following line to a `.env.local` file. ``` REACT_APP_TYPE_CHECK_SANCTUARY=true diff --git a/new-lamassu-admin/package-lock.json b/new-lamassu-admin/package-lock.json index 19eb5023..3034a270 100644 --- a/new-lamassu-admin/package-lock.json +++ b/new-lamassu-admin/package-lock.json @@ -54,7 +54,6 @@ "react-router-dom": "5.1.2", "react-use": "15.3.2", "react-virtualized": "^9.21.2", - "sanctuary": "^2.0.1", "ua-parser-js": "^1.0.2", "uuid": "^8.3.2", "yup": "0.32.9" @@ -24990,76 +24989,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "node_modules/sanctuary": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sanctuary/-/sanctuary-2.0.2.tgz", - "integrity": "sha512-KoXg2Q2Pzz4cn0MMn2V9HX5/RPatIzMkjlYHVtx3mhL09k3joNJlBGatwh8sCxF6m0liFvaN89JaM0VPWw/qAg==", - "dependencies": { - "sanctuary-def": "0.20.1", - "sanctuary-either": "1.2.0", - "sanctuary-maybe": "1.2.0", - "sanctuary-pair": "1.2.0", - "sanctuary-show": "1.0.0", - "sanctuary-type-classes": "11.0.0", - "sanctuary-type-identifiers": "2.0.1" - } - }, - "node_modules/sanctuary-def": { - "version": "0.20.1", - "resolved": "https://registry.npmjs.org/sanctuary-def/-/sanctuary-def-0.20.1.tgz", - "integrity": "sha512-WdOg5uDpqvplADyUb7pyDMNaT73TUzsE7VdKnZsEz6CwsNh46NSQAWZXM0i6IiqItnDtILkL5RGd4SGAvmjxLw==", - "dependencies": { - "sanctuary-either": "1.2.0", - "sanctuary-show": "1.0.x", - "sanctuary-type-classes": "11.0.x", - "sanctuary-type-identifiers": "2.0.x" - } - }, - "node_modules/sanctuary-either": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/sanctuary-either/-/sanctuary-either-1.2.0.tgz", - "integrity": "sha512-CFUK0OOGAe+t+Ct4yVLfkJPABIkplCvIgCOFIJZ+lIMNAeJrSaVacrZVqRErt4YKzDs42ZXecAEpoDL8rRAfsQ==", - "dependencies": { - "sanctuary-show": "1.0.x", - "sanctuary-type-classes": "11.0.0" - } - }, - "node_modules/sanctuary-maybe": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/sanctuary-maybe/-/sanctuary-maybe-1.2.0.tgz", - "integrity": "sha512-SH4dkyrruJe84/q8YMjc6kWyGbqPH6clM6yfJ/iosQZm+bGK2XPgcPs1yDN0U0zm1JzJ563zdwn64W+aMw5CDw==", - "dependencies": { - "sanctuary-show": "1.0.x", - "sanctuary-type-classes": "11.0.0" - } - }, - "node_modules/sanctuary-pair": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/sanctuary-pair/-/sanctuary-pair-1.2.0.tgz", - "integrity": "sha512-bPu+uFxFE2RP3hLlC6SRMsm4A2aEwHkDwHWuvGzHxYaclGnHCrHy0ykRTuR0Pgqy/ZlWl6zy+8Tek3jME3du6A==", - "dependencies": { - "sanctuary-show": "1.0.x", - "sanctuary-type-classes": "11.0.0" - } - }, - "node_modules/sanctuary-show": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sanctuary-show/-/sanctuary-show-1.0.0.tgz", - "integrity": "sha512-63UqNGr5M6wkzKp6eGc/Gy6JBIV2PbzPd3q88+0F9z0qydAQsCWJ+7e4oor39rEEwj2GkZMDEhqGuiMl9eEnYw==" - }, - "node_modules/sanctuary-type-classes": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/sanctuary-type-classes/-/sanctuary-type-classes-11.0.0.tgz", - "integrity": "sha512-J9vfS19C9TSd0pIxz7dza0krxUGoo7LYdwQzkmO7zEsbzmPEwbB3HByLgN/zI+QYd0m08IdohAzYJSAd89Fdqg==", - "dependencies": { - "sanctuary-type-identifiers": "2.0.1" - } - }, - "node_modules/sanctuary-type-identifiers": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/sanctuary-type-identifiers/-/sanctuary-type-identifiers-2.0.1.tgz", - "integrity": "sha1-/FJM9t2Szr/LsN2VCe/xkxWaIO0=" - }, "node_modules/sane": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", diff --git a/new-lamassu-admin/package.json b/new-lamassu-admin/package.json index cfc033ce..c5f8200c 100644 --- a/new-lamassu-admin/package.json +++ b/new-lamassu-admin/package.json @@ -47,7 +47,6 @@ "react-router-dom": "5.1.2", "react-use": "15.3.2", "react-virtualized": "^9.21.2", - "sanctuary": "^2.0.1", "ua-parser-js": "^1.0.2", "uuid": "^8.3.2", "yup": "0.32.9" diff --git a/new-lamassu-admin/src/utils/sanctuary.js b/new-lamassu-admin/src/utils/sanctuary.js deleted file mode 100644 index 9172e6a9..00000000 --- a/new-lamassu-admin/src/utils/sanctuary.js +++ /dev/null @@ -1,17 +0,0 @@ -import * as sanctuary from 'sanctuary' - -const checkOnlyDev = () => { - if (process.env.NODE_ENV !== 'production') return false - - return ( - process.env.NODE_ENV === 'development' && - process.env.REACT_APP_TYPE_CHECK_SANCTUARY === 'true' - ) -} - -const S = sanctuary.create({ - checkTypes: checkOnlyDev(), - env: sanctuary.env -}) - -export default S diff --git a/new-lamassu-admin/src/utils/string.js b/new-lamassu-admin/src/utils/string.js index d210cfba..f48f2e28 100644 --- a/new-lamassu-admin/src/utils/string.js +++ b/new-lamassu-admin/src/utils/string.js @@ -1,7 +1,5 @@ import * as R from 'ramda' -import S from './sanctuary' - const formatLong = value => { if (!value || value.length <= 20) return value @@ -11,22 +9,24 @@ const formatLong = value => { )}` } -const toFirstLower = S.compose(S.joinWith(''))(R.adjust(0, S.toLower)) -const toFirstUpper = S.compose(S.joinWith(''))(R.adjust(0, S.toUpper)) -const onlyFirstToUpper = S.compose(toFirstUpper)(S.toLower) +const toFirstLower = R.compose(R.join(''), R.adjust(0, R.toLower)) + +const toFirstUpper = R.compose(R.join(''), R.adjust(0, R.toUpper)) + +const onlyFirstToUpper = R.compose(toFirstUpper, R.toLower) const splitOnUpper = R.compose( - S.splitOn(' '), + R.split(' '), R.replace(/([A-Z])/g, ' $1'), toFirstLower ) const startCase = R.compose( - S.joinWith(' '), - S.map(onlyFirstToUpper), + R.join(' '), + R.map(onlyFirstToUpper), splitOnUpper ) -const sentenceCase = R.compose(onlyFirstToUpper, S.joinWith(' '), splitOnUpper) +const sentenceCase = R.compose(onlyFirstToUpper, R.join(' '), splitOnUpper) const singularOrPlural = (amount, singularStr, pluralStr) => parseInt(amount) === 1 ? singularStr : pluralStr