From d7f1fa8aba1168aed343f7cb373ecccc6af8f2bb Mon Sep 17 00:00:00 2001 From: Floyd Pink Date: Thu, 13 Feb 2020 12:30:37 -0500 Subject: [PATCH] remove the dependency on lodash --- .eslintrc | 148 +++++++++++++------------ .idea/jsLinters/eslint.xml | 6 + lib/celestial/planetarySystem/index.js | 5 +- package-lock.json | 3 +- package.json | 4 +- 5 files changed, 87 insertions(+), 79 deletions(-) create mode 100644 .idea/jsLinters/eslint.xml diff --git a/.eslintrc b/.eslintrc index cda93880f..9096f3860 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,138 +1,142 @@ { - "extends" : "eslint:recommended", - "env" : { - "node" : true, + "parser": "babel-eslint", + "extends": "eslint:recommended", + "env": { + "node": true, "mocha": true, - "es6" : true + "es6": true }, - "rules" : { - "array-bracket-spacing" : [ + "rules": { + "array-bracket-spacing": [ 2, "never" ], - "brace-style" : [ + "brace-style": [ 2, "1tbs" ], - "comma-style" : 2, - "consistent-return" : 0, - "indent" : [ + "comma-style": 2, + "consistent-return": 0, + "indent": [ 2, 2 ], - "no-multiple-empty-lines" : [ + "no-multiple-empty-lines": [ 2, { "max": 2 } ], - "no-use-before-define" : [ + "no-use-before-define": [ 2, "nofunc" ], - "one-var" : [ + "one-var": [ 2, "never" ], - "quote-props" : [ + "quote-props": [ 2, "as-needed" ], - "quotes" : [ + "quotes": [ 2, "single" ], - "keyword-spacing" : 2, + "keyword-spacing": 2, "space-before-function-paren": [ 2, { "anonymous": "always", - "named" : "never" + "named": "never" } ], - "strict" : [ + "strict": [ 2, "global" ], - "curly" : [ + "curly": [ 2, "all" ], - "eol-last" : 2, - "key-spacing" : [ + "eol-last": 2, + "key-spacing": [ 2, { - "align" : "colon", + "align": "colon", "beforeColon": true, - "afterColon" : true + "afterColon": true } ], - "no-eval" : 2, - "no-with" : 2, - "space-infix-ops" : 2, - "dot-notation" : [ + "no-eval": 2, + "no-with": 2, + "space-infix-ops": 2, + "dot-notation": [ 2, { "allowKeywords": true } ], - "eqeqeq" : [ + "eqeqeq": [ 2, "allow-null" ], - "guard-for-in" : 2, - "no-alert" : 2, - "no-bitwise" : 2, - "no-caller" : 2, - "no-extend-native" : 2, - "no-extra-bind" : 2, - "no-extra-parens" : 2, - "no-implied-eval" : 2, - "no-iterator" : 2, - "no-label-var" : 2, - "no-labels" : 2, - "no-lone-blocks" : 2, - "no-loop-func" : 2, - "no-multi-spaces" : 2, - "no-multi-str" : 2, - "no-native-reassign" : 2, - "no-new" : 2, - "no-new-func" : 2, - "no-new-wrappers" : 2, - "no-octal-escape" : 2, - "no-proto" : 2, - "no-return-assign" : 2, - "no-script-url" : 2, - "no-sequences" : 2, - "no-unused-expressions" : 2, - "yoda" : 2, - "no-shadow" : 2, - "no-shadow-restricted-names" : 2, - "no-undef-init" : 2, - "camelcase" : 2, - "comma-spacing" : 2, - "new-cap" : 2, - "new-parens" : 2, - "no-array-constructor" : 2, - "no-new-object" : 2, - "no-spaced-func" : 2, - "no-trailing-spaces" : 2, - "no-underscore-dangle" : 2, - "semi" : 2, - "semi-spacing" : [ + "guard-for-in": 2, + "no-alert": 2, + "no-bitwise": 2, + "no-caller": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-parens": 2, + "no-implied-eval": 2, + "no-iterator": 2, + "no-label-var": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-loop-func": 2, + "no-multi-spaces": 2, + "no-multi-str": 2, + "no-native-reassign": 2, + "no-new": 2, + "no-new-func": 2, + "no-new-wrappers": 2, + "no-octal-escape": 2, + "no-proto": 2, + "no-return-assign": 2, + "no-script-url": 2, + "no-sequences": 2, + "no-unused-expressions": 2, + "yoda": 2, + "no-shadow": 2, + "no-shadow-restricted-names": 2, + "no-undef-init": 2, + "camelcase": 2, + "comma-spacing": 2, + "new-cap": 2, + "new-parens": 2, + "no-array-constructor": 2, + "no-new-object": 2, + "no-spaced-func": 2, + "no-trailing-spaces": 2, + "no-underscore-dangle": 2, + "semi": 2, + "semi-spacing": [ 2, { "before": false, - "after" : true + "after": true } ], - "wrap-iife" : [ + "wrap-iife": [ 2, "inside" ] }, "parserOptions": { - "sourceType" : "module", - "ecmaVersion": 6 + "sourceType": "module", + "ecmaVersion": 6, + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } } } diff --git a/.idea/jsLinters/eslint.xml b/.idea/jsLinters/eslint.xml new file mode 100644 index 000000000..7e0cb18ef --- /dev/null +++ b/.idea/jsLinters/eslint.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lib/celestial/planetarySystem/index.js b/lib/celestial/planetarySystem/index.js index 7e91fac45..ab6c1e86c 100644 --- a/lib/celestial/planetarySystem/index.js +++ b/lib/celestial/planetarySystem/index.js @@ -9,8 +9,6 @@ /** * @module planetarySystem */ -import _ from 'lodash'; - import planets from './planets/index.js'; import Yuga from './yuga.js'; @@ -60,7 +58,8 @@ class PlanetarySystem { PlanetarySystem.initializePlanetaryConstants(); - planetsList = _.keyBy([star, sun, moon, mercury, venus, mars, jupiter, saturn, candrocca, rahu], 'name'); + planetsList = [star, sun, moon, mercury, venus, mars, jupiter, saturn, candrocca, rahu] + .reduce((list, planet) => ({...list, [planet.name] : planet}), {}); } diff --git a/package-lock.json b/package-lock.json index 11df5bef3..c6e8657e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6662,7 +6662,8 @@ "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true }, "lodash.flattendeep": { "version": "4.4.0", diff --git a/package.json b/package.json index a0a0cf39b..f9fa920fd 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,5 @@ "test": "nyc --require @babel/register _mocha --recursive test" }, "license": "MIT", - "dependencies": { - "lodash": "^4.17.15" - } + "dependencies": {} }