diff options
| author | bozo.kopic <bozo.kopic@gmail.com> | 2017-08-16 15:11:21 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo.kopic@gmail.com> | 2017-08-16 15:11:21 +0200 |
| commit | 28446d95471e74de364b53c3f24d6182fddac0e0 (patch) | |
| tree | 5cf96e6d26a8e27aef74464c6a0a3b0ab191ffff /src_js/hatter/lenses.js | |
| parent | 1b6052d7e74d90806650ff09153c581e7ae851eb (diff) | |
backend
Diffstat (limited to 'src_js/hatter/lenses.js')
| -rw-r--r-- | src_js/hatter/lenses.js | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src_js/hatter/lenses.js b/src_js/hatter/lenses.js deleted file mode 100644 index 39da314..0000000 --- a/src_js/hatter/lenses.js +++ /dev/null @@ -1,21 +0,0 @@ -import R from 'ramda'; - - -export const index = R.lensIndex; - -export const prop = R.lensProp; - -export function path(...xs) { - return R.reduce((acc, i) => R.compose(acc, pathParamToLens(i)), - R.identity, xs); -} - -function pathParamToLens(x) { - switch (typeof(x)) { - case 'function': return x; - case 'number': return index(x); - case 'string': return prop(x); - case 'object': if (Array.isArray(x)) return R.apply(path, x); - } - throw 'Invalid path parameter'; -} |
