pepka 1.3.1 → 1.4.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
@@ -136,7 +136,7 @@ const qstartsWithWith = (comparator) => curry2((start, s) => {
136
136
  return true;
137
137
  });
138
138
 
139
- // TODO: qflat, qoverProp, qover array ?
139
+ // TODO: qflat, qpick, qoverProp, qover array ?
140
140
  const qappend = curry2((s, xs) => { xs.push(s); return xs; });
141
141
  const qassoc = curry3((prop, v, obj) => { obj[prop] = v; return obj; });
142
142
  const qreduce = curry3((fn, accum, arr) => arr.reduce(fn, accum));
@@ -339,6 +339,7 @@ const range = curry2((from, to) => genBy(add(from), to - from));
339
339
  /** @param xs any[] @returns xs without duplicates. */
340
340
  const uniq = (xs) => qreduce((accum, x) => find(equals(x), accum) ? accum : qappend(x, accum), [], xs);
341
341
  const intersection = curry2((xs1, xs2) => xs1.filter(flip(includes)(xs2)));
342
+ const diff = curry2((xs1, xs2) => xs1.filter(complement(flip(includes)(xs2))));
342
343
  const genBy = curry2((generator, length) => [...Array(length)].map((_, i) => generator(i)));
343
344
  const once = (fn) => {
344
345
  let done = false, cache;
@@ -592,6 +593,7 @@ exports.cond = cond;
592
593
  exports.curry = curry;
593
594
  exports.curry2 = curry2;
594
595
  exports.curry3 = curry3;
596
+ exports.diff = diff;
595
597
  exports.divide = divide;
596
598
  exports.echo = echo;
597
599
  exports.empty = empty;
package/dist/bundle.d.ts CHANGED
@@ -271,6 +271,12 @@ export declare const intersection: {
271
271
  (a: any[]): (b: any[]) => any[];
272
272
  (a: any[], b: any[]): any[];
273
273
  };
274
+ export declare const diff: {
275
+ (a: symbol, b: any[]): (a: any[]) => any[];
276
+ (a: any[], b: symbol): (b: any[]) => any[];
277
+ (a: any[]): (b: any[]) => any[];
278
+ (a: any[], b: any[]): any[];
279
+ };
274
280
  export declare const genBy: {
275
281
  (a: symbol, b: number): (a: (i: number) => any) => any[];
276
282
  (a: (i: number) => any, b: symbol): (b: number) => any[];
package/dist/bundle.mjs CHANGED
@@ -134,7 +134,7 @@ const qstartsWithWith = (comparator) => curry2((start, s) => {
134
134
  return true;
135
135
  });
136
136
 
137
- // TODO: qflat, qoverProp, qover array ?
137
+ // TODO: qflat, qpick, qoverProp, qover array ?
138
138
  const qappend = curry2((s, xs) => { xs.push(s); return xs; });
139
139
  const qassoc = curry3((prop, v, obj) => { obj[prop] = v; return obj; });
140
140
  const qreduce = curry3((fn, accum, arr) => arr.reduce(fn, accum));
@@ -337,6 +337,7 @@ const range = curry2((from, to) => genBy(add(from), to - from));
337
337
  /** @param xs any[] @returns xs without duplicates. */
338
338
  const uniq = (xs) => qreduce((accum, x) => find(equals(x), accum) ? accum : qappend(x, accum), [], xs);
339
339
  const intersection = curry2((xs1, xs2) => xs1.filter(flip(includes)(xs2)));
340
+ const diff = curry2((xs1, xs2) => xs1.filter(complement(flip(includes)(xs2))));
340
341
  const genBy = curry2((generator, length) => [...Array(length)].map((_, i) => generator(i)));
341
342
  const once = (fn) => {
342
343
  let done = false, cache;
@@ -564,4 +565,4 @@ const composeAsync = (() => {
564
565
  return (...fns) => (...input) => pipe(fns, input, fns.length - 1);
565
566
  })();
566
567
 
567
- export { F, T, __, add, all, allPass, always, any, anyPass, append, assoc, assocPath, bind, both, callFrom, callWith, clone, cloneShallow, complement, compose, composeAsync, concat, cond, curry, curry2, curry3, divide, echo, empty, eq, equals, explore, filter, find, findIndex, flat, flatShallow, flatTo, flip, forEach, forEachAsync, 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, qfreeze, qfreezeShallow, qmap, qmapKeys, qmapObj, qmergeDeep, qmergeDeepAdd, qmergeDeepX, qmergeShallow, qomit, qprepend, qreduce, qreverse, qstartsWith, qstartsWithWith, range, reduce, reflect, replace, reverse, sizeof, slice, some, sort, split, startsWith, subtract, symbol, tail, take, tap, test, toLower, toPairs, toUpper, trim, type, typeIs, uncurry, uniq, values, waitAll, waitTap, weakEq, when, zip, zipObj, zipWith };
568
+ export { F, T, __, add, all, allPass, always, any, anyPass, append, assoc, assocPath, bind, both, callFrom, callWith, clone, cloneShallow, complement, compose, composeAsync, concat, cond, curry, curry2, curry3, diff, divide, echo, empty, eq, equals, explore, filter, find, findIndex, flat, flatShallow, flatTo, flip, forEach, forEachAsync, 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, qfreeze, qfreezeShallow, qmap, qmapKeys, qmapObj, qmergeDeep, qmergeDeepAdd, qmergeDeepX, qmergeShallow, qomit, qprepend, qreduce, qreverse, qstartsWith, qstartsWithWith, range, reduce, reflect, replace, reverse, sizeof, slice, some, sort, split, startsWith, subtract, symbol, tail, take, tap, test, toLower, toPairs, toUpper, trim, type, typeIs, uncurry, uniq, values, waitAll, waitTap, weakEq, when, zip, zipObj, zipWith };
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
44
44
  "all": "npm run dev && npm run prod"
45
45
  },
46
- "version": "1.3.1",
46
+ "version": "1.4.1",
47
47
  "ava": {
48
48
  "files": [
49
49
  "./test/specs/*.ts"
package/src/quick.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { curry2, curry3 } from "./curry"
2
- import { includes, isNil, type, length, eq, qstartsWithWith } from "./common"
2
+ import { includes, isNil, type, eq, qstartsWithWith } from "./common"
3
3
  import { AnyObject, Reducer, AnyFunc } from "./types"
4
4
  import { isFunc, isArray, isObj } from "./utils"
5
- // TODO: qflat, qoverProp, qover array ?
5
+ // TODO: qflat, qpick, qoverProp, qover array ?
6
6
 
7
7
  export const qappend = curry2((s: any, xs: any[]) => {xs.push(s); return xs})
8
8
  export const qassoc = curry3((prop: string, v: any, obj: AnyObject) => { obj[prop] = v; return obj })
package/src/safe.ts CHANGED
@@ -129,9 +129,8 @@ export const uniq = (xs: any[]) => qreduce(
129
129
  <T>(accum: any, x: T) =>
130
130
  find(equals(x), accum) ? accum : qappend(x, accum),
131
131
  [], xs)
132
- export const intersection = curry2(
133
- (xs1: any[], xs2: any[]) => xs1.filter(flip(includes)(xs2))
134
- )
132
+ export const intersection = curry2((xs1: any[], xs2: any[]) => xs1.filter(flip(includes)(xs2)))
133
+ export const diff = curry2( (xs1: any[], xs2: any[]) => xs1.filter(complement(flip(includes)(xs2))) )
135
134
  export const genBy = curry2(
136
135
  (
137
136
  generator: (i: number) => any,