pepka 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs CHANGED
@@ -350,7 +350,7 @@ const quniq = (xs) => {
350
350
  const qpush = qappend;
351
351
 
352
352
  const { assign } = Object;
353
- // TODO: over, lensProp, reduceAsync, propsEq is up to 20x slow due to deep equals.
353
+ // TODO: over, reduceAsync, propsEq is up to 20x slow due to deep equals.
354
354
  const take = (argN) => (...args) => args[argN];
355
355
  const ifElse = curry((cond, pipeYes, pipeNo, s) => cond(s) ? pipeYes(s) : pipeNo(s));
356
356
  const when = curry3((cond, pipe, s) => ifElse(cond, pipe, identity, s));
@@ -636,8 +636,13 @@ const mergeShallow = curry2((o1, o2) => assign({}, o1, o2));
636
636
  const mergeDeep = curry2((a, b) => qmergeDeep(clone(a), b));
637
637
  const mergeDeepX = curry2((a, b) => qmergeDeepX(clone(a), b));
638
638
  const mergeDeepAdd = curry2((a, b) => qmergeDeepAdd(clone(a), b));
639
- /** @param prop string @param pipe(data[prop]) @param data any @returns data with prop over pipe. */
640
- const overProp = curry3((prop, pipe, data) => assoc(prop, pipe(data[prop]), data));
639
+ /**
640
+ * @param prop string
641
+ * @param pipe(data[prop])
642
+ * @param data any
643
+ * @returns data with prop over pipe.
644
+ */
645
+ const overProp = curry3((prop, pipe, data) => (prop in data) && assoc(prop, pipe(data[prop]), data));
641
646
  /** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
642
647
  const mapKeys = curry2((keyMap, o) => qmapKeys(keyMap, assign({}, o)));
643
648
  const zip = curry2((a, b) => map((s, i) => [s, b[i]], a));
@@ -659,6 +664,7 @@ const push = append;
659
664
  const some = any;
660
665
  const weakEq = eq;
661
666
  const uniqBy = uniqWith;
667
+ const propLens = overProp;
662
668
 
663
669
  /** One promise waits for another. */
664
670
  const forEachSerial = (() => {
@@ -893,6 +899,7 @@ exports.pickBy = pickBy;
893
899
  exports.prepend = prepend;
894
900
  exports.prop = prop;
895
901
  exports.propEq = propEq;
902
+ exports.propLens = propLens;
896
903
  exports.propsEq = propsEq;
897
904
  exports.push = push;
898
905
  exports.qappend = qappend;
package/dist/bundle.d.ts CHANGED
@@ -715,7 +715,12 @@ export declare const mergeDeepAdd: {
715
715
  (a: AnyObject): (b: AnyObject) => AnyObject;
716
716
  (a: AnyObject, b: AnyObject): AnyObject;
717
717
  };
718
- /** @param prop string @param pipe(data[prop]) @param data any @returns data with prop over pipe. */
718
+ /**
719
+ * @param prop string
720
+ * @param pipe(data[prop])
721
+ * @param data any
722
+ * @returns data with prop over pipe.
723
+ */
719
724
  export declare const overProp: (...args: AnyArgs) => any;
720
725
  /** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
721
726
  export declare const mapKeys: {
@@ -779,6 +784,7 @@ export declare const uniqBy: {
779
784
  (a: (x: any, y: any) => boolean): (b: any[]) => any;
780
785
  (a: (x: any, y: any) => boolean, b: any[]): any;
781
786
  };
787
+ export declare const propLens: (...args: AnyArgs) => any;
782
788
  type StrTmpl = ((data: AnyObject) => string);
783
789
  /** Supports ecrans: '\\{"json": {yes} \\}'
784
790
  @returns getTmpl('one{meme}two')({meme: 42}) -> one42two */
package/dist/bundle.mjs CHANGED
@@ -348,7 +348,7 @@ const quniq = (xs) => {
348
348
  const qpush = qappend;
349
349
 
350
350
  const { assign } = Object;
351
- // TODO: over, lensProp, reduceAsync, propsEq is up to 20x slow due to deep equals.
351
+ // TODO: over, reduceAsync, propsEq is up to 20x slow due to deep equals.
352
352
  const take = (argN) => (...args) => args[argN];
353
353
  const ifElse = curry((cond, pipeYes, pipeNo, s) => cond(s) ? pipeYes(s) : pipeNo(s));
354
354
  const when = curry3((cond, pipe, s) => ifElse(cond, pipe, identity, s));
@@ -634,8 +634,13 @@ const mergeShallow = curry2((o1, o2) => assign({}, o1, o2));
634
634
  const mergeDeep = curry2((a, b) => qmergeDeep(clone(a), b));
635
635
  const mergeDeepX = curry2((a, b) => qmergeDeepX(clone(a), b));
636
636
  const mergeDeepAdd = curry2((a, b) => qmergeDeepAdd(clone(a), b));
637
- /** @param prop string @param pipe(data[prop]) @param data any @returns data with prop over pipe. */
638
- const overProp = curry3((prop, pipe, data) => assoc(prop, pipe(data[prop]), data));
637
+ /**
638
+ * @param prop string
639
+ * @param pipe(data[prop])
640
+ * @param data any
641
+ * @returns data with prop over pipe.
642
+ */
643
+ const overProp = curry3((prop, pipe, data) => (prop in data) && assoc(prop, pipe(data[prop]), data));
639
644
  /** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
640
645
  const mapKeys = curry2((keyMap, o) => qmapKeys(keyMap, assign({}, o)));
641
646
  const zip = curry2((a, b) => map((s, i) => [s, b[i]], a));
@@ -657,6 +662,7 @@ const push = append;
657
662
  const some = any;
658
663
  const weakEq = eq;
659
664
  const uniqBy = uniqWith;
665
+ const propLens = overProp;
660
666
 
661
667
  /** One promise waits for another. */
662
668
  const forEachSerial = (() => {
@@ -798,4 +804,4 @@ const wait = (time) => new QPromise((ff) => setTimeout(ff, time), (timeout) => c
798
804
  // TODO: possibly introduce a second argument limiting unfolding.
799
805
  const uncurry = (fn) => (...args) => qreduce(((fn, arg) => fn ? fn(arg) : fn), fn, args);
800
806
 
801
- export { F, QPromise, T, __, add, all, allPass, always, any, anyPass, append, assoc, assocPath, bind, both, callFrom, callWith, clone, cloneShallow, complement, compose, composeAsync, concat, cond, curry, curry2, curry3, debounce, diff, divide, echo, empty, eq, equals, explore, filter, find, findIndex, flat, flatShallow, flatTo, flip, forEach, forEachParallel, forEachSerial, freeze, freezeShallow, fromPairs, genBy, getTmpl, gt, gte, head, identity, ifElse, includes, indexOf, intersection, isEmpty, isNil, join, keys, last, length, lt, lte, map, mapKeys, mapObj, memoize, mergeDeep, mergeDeepAdd, mergeDeepX, mergeShallow, mirror, multiply, noop, not, notf, nth, omit, once, overProp, path, pathEq, pathExists, pathOr, pathsEq, pick, pickBy, prepend, prop, propEq, propsEq, push, qappend, qassoc, qassocPath, qempty, qfilter, qfilterAsync, qfreeze, qfreezeShallow, qmap, qmapKeys, qmapObj, qmergeDeep, qmergeDeepAdd, qmergeDeepX, qmergeShallow, qomit, qoverProp, qpick, qprepend, qpush, qreduce, qreverse, qslice, qsort, quniq, qwaitAll, range, reduce, reflect, replace, reverse, sizeof, slice, some, sort, split, startsWith, startsWithShallow, subtract, symbol, tail, take, tap, test, throttle, toLower, toPairs, toUpper, trim, type, typeIs, uncurry, uniq, uniqBy, uniqWith, values, wait, waitAll, waitTap, weakEq, when, zip, zipObj, zipWith };
807
+ export { F, QPromise, T, __, add, all, allPass, always, any, anyPass, append, assoc, assocPath, bind, both, callFrom, callWith, clone, cloneShallow, complement, compose, composeAsync, concat, cond, curry, curry2, curry3, debounce, diff, divide, echo, empty, eq, equals, explore, filter, find, findIndex, flat, flatShallow, flatTo, flip, forEach, forEachParallel, forEachSerial, freeze, freezeShallow, fromPairs, genBy, getTmpl, gt, gte, head, identity, ifElse, includes, indexOf, intersection, isEmpty, isNil, join, keys, last, length, lt, lte, map, mapKeys, mapObj, memoize, mergeDeep, mergeDeepAdd, mergeDeepX, mergeShallow, mirror, multiply, noop, not, notf, nth, omit, once, overProp, path, pathEq, pathExists, pathOr, pathsEq, pick, pickBy, prepend, prop, propEq, propLens, propsEq, push, qappend, qassoc, qassocPath, qempty, qfilter, qfilterAsync, qfreeze, qfreezeShallow, qmap, qmapKeys, qmapObj, qmergeDeep, qmergeDeepAdd, qmergeDeepX, qmergeShallow, qomit, qoverProp, qpick, qprepend, qpush, qreduce, qreverse, qslice, qsort, quniq, qwaitAll, range, reduce, reflect, replace, reverse, sizeof, slice, some, sort, split, startsWith, startsWithShallow, subtract, symbol, tail, take, tap, test, throttle, toLower, toPairs, toUpper, trim, type, typeIs, uncurry, uniq, uniqBy, uniqWith, values, wait, waitAll, waitTap, weakEq, when, zip, zipObj, zipWith };
package/package.json CHANGED
@@ -41,7 +41,7 @@
41
41
  "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
42
42
  "all": "npm run dev && npm run prod"
43
43
  },
44
- "version": "1.11.0",
44
+ "version": "1.11.1",
45
45
  "devDependencies": {
46
46
  "@rollup/plugin-commonjs": "^29.0.2",
47
47
  "@rollup/plugin-node-resolve": "^16.0.3",
package/src/safe.ts CHANGED
@@ -6,7 +6,7 @@ import { qappend, qfilter, qfreeze, qfreezeShallow, qmapKeys, qmapObj, qmergeDee
6
6
  import { AnyFunc, AnyObject, Composed, Cond, Reducer } from './types'
7
7
  import { inf, isArray, isFunc, isNil, isNum, isObj, undef } from './utils'
8
8
  const {assign} = Object
9
- // TODO: over, lensProp, reduceAsync, propsEq is up to 20x slow due to deep equals.
9
+ // TODO: over, reduceAsync, propsEq is up to 20x slow due to deep equals.
10
10
 
11
11
  export const take = (argN: number) => (...args: any[]) => args[argN]
12
12
  export const ifElse = curry(
@@ -422,10 +422,15 @@ export const mergeDeepX = curry2(
422
422
  export const mergeDeepAdd = curry2(
423
423
  (a: AnyObject, b: AnyObject) => qmergeDeepAdd(clone(a), b) as AnyObject
424
424
  )
425
- /** @param prop string @param pipe(data[prop]) @param data any @returns data with prop over pipe. */
425
+ /**
426
+ * @param prop string
427
+ * @param pipe(data[prop])
428
+ * @param data any
429
+ * @returns data with prop over pipe.
430
+ */
426
431
  export const overProp = curry3(
427
432
  (prop: string, pipe: AnyFunc, data: any) =>
428
- assoc(prop, pipe(data[prop]), data)
433
+ (prop in data) && assoc(prop, pipe(data[prop]), data)
429
434
  )
430
435
  /** mapKeys({ a: 'b' }, { a: 44 }) -> { b: 44 } */
431
436
  export const mapKeys = curry2(
@@ -465,4 +470,5 @@ export const notf = complement
465
470
  export const push = append
466
471
  export const some = any
467
472
  export const weakEq = eq
468
- export const uniqBy = uniqWith
473
+ export const uniqBy = uniqWith
474
+ export const propLens = overProp