pepka 0.14.0-beta4 → 0.14.0-beta7

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.d.ts CHANGED
@@ -11,7 +11,6 @@ export type AnyArgs = any[];
11
11
  export type Curried<Args extends AnyArgs = AnyArgs, ReturnT = any> = (arg: Args[number]) => Curried<Args> | ReturnT;
12
12
  export type Reducer = <T = any>(accum: T, cur: any, index: number) => T;
13
13
  export type AnyFunc<ReturnT = any, Args extends AnyArgs = AnyArgs> = (...args: Args) => ReturnT;
14
- export type TupleFn<ARG1 = any, ARG2 = any, Out = any> = (a: ARG1, b: ARG2) => Out;
15
14
  export type Placeholder = symbol;
16
15
  declare const __: Placeholder;
17
16
  export declare const curry: <Func extends AnyFunc<any, AnyArgs>>(fn: AnyFunc) => FT.Curry<Func>;
@@ -64,7 +63,12 @@ export declare const includes: {
64
63
  (a: unknown, b: unknown[]): boolean;
65
64
  };
66
65
  export declare const slice: FT.Curry<(from: number, to: number, o: any[] | string) => string | any[]>;
67
- export declare const flip: <ARG1 = any, ARG2 = any, Out = any>(fn: FT.Curry<TupleFn<ARG1, ARG2, Out>>) => FT.Curry<TupleFn<ARG2, ARG1, Out>>;
66
+ export declare const flip: <T extends AnyFunc<any, AnyArgs>>(fn: T) => {
67
+ (a: symbol, b: Parameters<T>[0]): (a: Parameters<T>[1]) => any;
68
+ (a: Parameters<T>[1], b: symbol): (b: Parameters<T>[0]) => any;
69
+ (a: Parameters<T>[1]): (b: Parameters<T>[0]) => any;
70
+ (a: Parameters<T>[1], b: Parameters<T>[0]): any;
71
+ };
68
72
  export declare const head: (b: string | unknown[]) => unknown;
69
73
  export declare const tail: FT.Curry<(o: string | any[]) => string | any[]>;
70
74
  export declare const add: {
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "exports": {
24
24
  ".": {
25
25
  "module": "./dist/bundle.mjs",
26
- "commonjs": "./dist/bundle.cjs"
26
+ "require": "./dist/bundle.cjs"
27
27
  }
28
28
  },
29
29
  "name": "pepka",
@@ -44,7 +44,7 @@
44
44
  "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
45
45
  "all": "npm run dev && npm run prod"
46
46
  },
47
- "version": "0.14.0-beta4",
47
+ "version": "0.14.0-beta7",
48
48
  "ava": {
49
49
  "files": [ "./test/specs/*.ts" ],
50
50
  "failFast": true,
package/src/safe.ts CHANGED
@@ -87,10 +87,10 @@ export const slice = curry3(
87
87
  (from: number, to: number, o: any[] | string) =>
88
88
  o.slice(from, (isNum(to)?to:inf) as number)
89
89
  )
90
- export const flip = <ARG1=any, ARG2=any, Out=any>(
91
- fn: FT.Curry<TupleFn<ARG1, ARG2, Out>>
92
- ): FT.Curry<TupleFn<ARG2, ARG1, Out>> =>
93
- curry2((b: ARG2, a: ARG1) => fn(a as any, b as any))
90
+ export const flip =
91
+ <T extends AnyFunc>(fn: T) => curry2(
92
+ (b: Parameters<T>[1], a: Parameters<T>[0]) => fn(a, b)
93
+ )
94
94
  export const head = nth(0)
95
95
  export const tail = slice(1, inf) // typeshit.
96
96
  export const add = curry2((n: number, m: number) => n+m)