pepka 1.6.13 → 1.6.14

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
@@ -140,7 +140,7 @@ const qstartsWithWith = (comparator) => curry2((start, s) => {
140
140
  });
141
141
 
142
142
  /* Then next fns seem to be excess due to their safe ver performance should be the same or better:
143
- * qflat, qpick, qslice, quniq
143
+ * qflat, qpick, qslice, quniq, qflat, qflatShallow, qreduceAsync
144
144
  */
145
145
  const qappend = curry2((s, xs) => { xs.push(s); return xs; });
146
146
  const qassoc = curry3((prop, v, obj) => { obj[prop] = v; return obj; });
@@ -264,7 +264,7 @@ const qpush = qappend;
264
264
  // TODO: possibly introduce a second argument limiting unfolding.
265
265
  const uncurry = (fn) => (...args) => qreduce(((fn, arg) => fn ? fn(arg) : fn), fn, args);
266
266
 
267
- // TODO: over, lensProp. propsEq is up to 20x slow due to deep equals.
267
+ // TODO: over, lensProp, reduceAsync, propsEq is up to 20x slow due to deep equals.
268
268
  const take = (argN) => (...args) => args[argN];
269
269
  const ifElse = curry((cond, pipeYes, pipeNo, s) => cond(s) ? pipeYes(s) : pipeNo(s));
270
270
  const when = curry3((cond, pipe, s) => ifElse(cond, pipe, identity, s));
package/dist/bundle.d.ts CHANGED
@@ -20,6 +20,7 @@ export interface AnyObject extends Record<any, any> {
20
20
  export type Reducer<T = any> = (accum: T, cur: any, index: number) => T;
21
21
  export type AnyFunc<ReturnT = any, Args extends AnyArgs = AnyArgs> = (...args: Args) => ReturnT;
22
22
  export type Curried<Args extends AnyArgs = AnyArgs, ReturnT = any> = (arg: Args[number]) => Curried<Args> | ReturnT;
23
+ export type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut;
23
24
  type Placeholder = symbol;
24
25
  export declare const __: Placeholder;
25
26
  export declare const curry: (fn: AnyFunc) => (...args: AnyArgs) => any;
@@ -73,7 +74,6 @@ export declare const isNil: <T extends any>(s: T) => T extends (null | undefined
73
74
  export declare const take: (argN: number) => (...args: any[]) => any;
74
75
  export declare const ifElse: (...args: AnyArgs) => any;
75
76
  export declare const when: (...args: AnyArgs) => any;
76
- type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut;
77
77
  export declare const compose: <TIn extends any[] = any[], TOut = any>(...fns: AnyFunc[]) => Composed<TIn, TOut>;
78
78
  export declare const bind: {
79
79
  (a: symbol, b: any): (a: any) => any;
@@ -718,7 +718,7 @@ export declare const forEachAsync: {
718
718
  (a: (item: any) => Promise<any>, b: any[]): Promise<any[]>;
719
719
  };
720
720
  /** The same as compose, but waits for promises in chains and returns a Promise. */
721
- export declare const composeAsync: <T = any>(...fns: AnyFunc[]) => (...input: any[]) => Promise<T>;
721
+ export declare const composeAsync: <TIn extends any[] = any[], TOut = any>(...fns: AnyFunc[]) => Composed<TIn, Promise<TOut>>;
722
722
 
723
723
  export {
724
724
  length$1 as length,
package/dist/bundle.mjs CHANGED
@@ -138,7 +138,7 @@ const qstartsWithWith = (comparator) => curry2((start, s) => {
138
138
  });
139
139
 
140
140
  /* Then next fns seem to be excess due to their safe ver performance should be the same or better:
141
- * qflat, qpick, qslice, quniq
141
+ * qflat, qpick, qslice, quniq, qflat, qflatShallow, qreduceAsync
142
142
  */
143
143
  const qappend = curry2((s, xs) => { xs.push(s); return xs; });
144
144
  const qassoc = curry3((prop, v, obj) => { obj[prop] = v; return obj; });
@@ -262,7 +262,7 @@ const qpush = qappend;
262
262
  // TODO: possibly introduce a second argument limiting unfolding.
263
263
  const uncurry = (fn) => (...args) => qreduce(((fn, arg) => fn ? fn(arg) : fn), fn, args);
264
264
 
265
- // TODO: over, lensProp. propsEq is up to 20x slow due to deep equals.
265
+ // TODO: over, lensProp, reduceAsync, propsEq is up to 20x slow due to deep equals.
266
266
  const take = (argN) => (...args) => args[argN];
267
267
  const ifElse = curry((cond, pipeYes, pipeNo, s) => cond(s) ? pipeYes(s) : pipeNo(s));
268
268
  const when = curry3((cond, pipe, s) => ifElse(cond, pipe, identity, s));
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.6.13",
44
+ "version": "1.6.14",
45
45
  "devDependencies": {
46
46
  "@rollup/plugin-commonjs": "^29.0.0",
47
47
  "@rollup/plugin-node-resolve": "^16.0.3",
package/src/async.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { curry2 } from "./curry"
2
2
  import { head } from "./safe"
3
- import { AnyFunc } from "./types"
3
+ import { AnyFunc, Composed } from "./types"
4
4
 
5
5
  /** One promise waits for another. */
6
6
  export const forEachSerial = (() => {
@@ -30,6 +30,6 @@ export const forEachAsync = curry2(
30
30
  export const composeAsync = (() => {
31
31
  const pipe = async (fns: AnyFunc[], input: any[], i: number): Promise<any> =>
32
32
  ~i ? await pipe(fns, [await fns[i](...input)], --i) : head(input)
33
- return <T = any>(...fns: AnyFunc[]) =>
34
- (...input: any[]) => pipe(fns, input, fns.length-1) as Promise<T>
33
+ return <TIn extends any[] = any[], TOut = any>(...fns: AnyFunc[]): Composed<TIn, Promise<TOut>> =>
34
+ (...input: any[]) => pipe(fns, input, fns.length-1)
35
35
  })()
package/src/quick.ts CHANGED
@@ -3,7 +3,7 @@ import { includes, type, eq, qstartsWithWith } from "./common"
3
3
  import { AnyObject, Reducer, AnyFunc } from "./types"
4
4
  import { isFunc, isArray, isObj, isNil } from "./utils"
5
5
  /* Then next fns seem to be excess due to their safe ver performance should be the same or better:
6
- * qflat, qpick, qslice, quniq
6
+ * qflat, qpick, qslice, quniq, qflat, qflatShallow, qreduceAsync
7
7
  */
8
8
 
9
9
  export const qappend = curry2((s: any, xs: any[]) => {xs.push(s); return xs})
package/src/safe.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { __, curry, curry2, curry3 } from './curry'
2
2
  import { isNum, undef, isArray, isFunc, isObj, inf, isNil } from './utils'
3
3
  import { qmergeDeep, qreduce, qappend, qmapKeys, qmergeDeepX, qmergeDeepAdd, qfilter, qfreeze, qfreezeShallow, qmapObj } from './quick'
4
- import { AnyFunc, Cond, AnyObject, Reducer } from './types'
4
+ import { AnyFunc, Composed, Cond, AnyObject, Reducer } from './types'
5
5
  import { symbol, type, length, equals, includes, qstartsWithWith, eq } from './common'
6
6
  import { Split, AnyArray, IndexesOfArray } from './internal_types'
7
7
  import { is_typed_arr } from './internal'
8
- // TODO: over, lensProp. propsEq is up to 20x slow due to deep equals.
8
+ // TODO: over, lensProp, reduceAsync, propsEq is up to 20x slow due to deep equals.
9
9
 
10
10
  export const take = (argN: number) => (...args: any[]) => args[argN]
11
11
  export const ifElse = curry(
@@ -23,7 +23,6 @@ export const when = curry3(
23
23
  s: any
24
24
  ) => ifElse(cond, pipe, identity, s)
25
25
  )
26
- type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut
27
26
  export const compose = (
28
27
  <TIn extends any[] = any[], TOut = any>(...fns: AnyFunc[]): Composed<TIn, TOut> =>
29
28
  (...args: TIn) => {
package/src/types.ts CHANGED
@@ -4,4 +4,5 @@ export type Cond = (x1?: any, x2?: any, x3?: any) => boolean
4
4
  export interface AnyObject extends Record<any, any> {}
5
5
  export type Reducer<T=any> = (accum: T, cur: any, index: number) => T
6
6
  export type AnyFunc<ReturnT = any, Args extends AnyArgs = AnyArgs> = (...args: Args) => ReturnT
7
- export type Curried<Args extends AnyArgs = AnyArgs, ReturnT = any> = (arg: Args[number]) => Curried<Args> | ReturnT
7
+ export type Curried<Args extends AnyArgs = AnyArgs, ReturnT = any> = (arg: Args[number]) => Curried<Args> | ReturnT
8
+ export type Composed<TIn extends any[], TOut> = (...xs: TIn) => TOut