Skip to content

Commit

Permalink
refactor: replace lodash packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Gipphe committed Oct 9, 2018
1 parent 3c25fd5 commit 581c542
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
"dependencies": {
"fantasy-land": "^3.5.0",
"hm-parser": "^0.1.5",
"lodash.cond": "^4.5.2",
"lodash.frompairs": "^4.0.1",
"mem": "^4.0.0",
"sanctuary": "^0.15.0",
"sanctuary-def": "^0.18.1",
Expand Down
14 changes: 12 additions & 2 deletions src/signature.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import S from 'sanctuary';
import HMP from 'hm-parser';
import memoize from 'mem';
import cond from 'lodash.cond';
import fromPairs from 'lodash.frompairs';
import Reader from './Reader';

/*
Expand Down Expand Up @@ -36,6 +34,18 @@ const indexBy = memoize
(f => S.reduce
(xs => x => S.insert (f (x)) (x) (xs))
({}));
// fromPairs :: Array (Array2 String a) -> StrMap a
const fromPairs = S.reduce
(acc => curr => S.insert (curr[0]) (curr[1]) (acc))
({});
// cond :: Array (Array2 (a -> Boolean) (a -> b)) -> a -> b
const cond = conds => x => {
const c = conds.find (y => y[0] (x));
if (c !== undefined) {
return c[1] (x);
}
throw new Error (`No predicate was satisfied for ${x}`);
};

// stripNamespace :: String -> String
const stripNamespace = memoize (xs => xs.split ('/').pop ());
Expand Down
10 changes: 0 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2143,21 +2143,11 @@ locate-path@^2.0.0:
p-locate "^2.0.0"
path-exists "^3.0.0"

lodash.cond@^4.5.2:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5"
integrity sha1-9HGh2khr5g9quVXRcRVSPdHSVdU=

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=

lodash.frompairs@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/lodash.frompairs/-/lodash.frompairs-4.0.1.tgz#bc4e5207fa2757c136e573614e9664506b2b1bd2"
integrity sha1-vE5SB/onV8E25XNhTpZkUGsrG9I=

lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
Expand Down

0 comments on commit 581c542

Please sign in to comment.