Comparing version 0.0.9 to 0.0.10
22
fx.js
@@ -1,2 +0,2 @@ | ||
// FxJS 0.0.9 | ||
// FxJS 0.0.10 | ||
export const | ||
@@ -141,2 +141,4 @@ identity = a => a, | ||
hi = tap(log), | ||
each = curry((f, coll) => go(reduce((_, a) => f(a), null, coll), _ => coll)); | ||
@@ -261,7 +263,7 @@ | ||
entries = Object.entries, | ||
entries = a => a ? Object.entries(a) : [], | ||
values = Object.values, | ||
values = a => a ? Object.values(a) : [], | ||
keys = Object.keys; | ||
keys = a => a ? Object.keys(a) : []; | ||
@@ -280,3 +282,6 @@ const basePick = filter => curry((ks, obj) => go( | ||
const baseExtend = set => (obj, ...objs) => reduce(reduce(set), obj, L.map(entries, objs)); | ||
const baseExtend = set => tap((obj, ...objs) => { | ||
const type = typeof obj; | ||
if (obj && (type == 'object' || type == 'function')) reduce(reduce(set), obj, L.map(entries, objs)); | ||
}); | ||
@@ -408,6 +413,3 @@ export const | ||
export const scat = curry((f, coll) => go( | ||
coll, | ||
L.map(f), | ||
reduce((a, b) => `${a}${b}`) | ||
)); | ||
export const scat = curry((f, coll) => | ||
reduce((a, b) => `${a}${b}`, '', L.map(f, coll))); |
{ | ||
"name": "fxjs2", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Functional Extensions for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,2 +19,3 @@ ## FxJS - Functional Extensions for Javascript | ||
- [L.filter](#L.filter) | ||
- [go](#go) | ||
@@ -84,1 +85,61 @@ #### map | ||
#### go | ||
```javascript | ||
const b = go( | ||
0, | ||
a => a + 1, | ||
a => a + 10, | ||
a => a + 100); | ||
console.log(b); | ||
// 111 | ||
try { | ||
const b = go( | ||
0, | ||
a => { throw { hi: 'ho' } }, | ||
a => a + 10, | ||
a => a + 100); | ||
console.log(b); | ||
} catch (c) { | ||
console.log(c); | ||
} | ||
// { hi: 'ho' } | ||
const b = await go( | ||
0, | ||
a => Promise.resolve(a + 1), | ||
a => a + 10, | ||
a => a + 100); | ||
console.log(b); | ||
// 111 | ||
try { | ||
const b = await go( | ||
0, | ||
a => Promise.resolve(a + 1), | ||
a => Promise.reject({ hi: 'ho' }), | ||
a => a + 100); | ||
console.log(b); | ||
} catch (c) { | ||
console.log(c); | ||
} | ||
// { hi: 'ho' } | ||
try { | ||
const b = await go( | ||
0, | ||
a => Promise.resolve(a + 1), | ||
a => Promise.reject({ hi: 'ho' }), | ||
a => a + 100); | ||
console.log(b); | ||
} catch (c) { | ||
console.log(c); | ||
} | ||
// { hi: 'ho' } | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12803
297
143