pepka 1.6.9 → 1.6.11

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
@@ -291,7 +291,7 @@ const slice = curry3((from, to, o) => o.slice(from, (isNum(to) ? to : inf)));
291
291
  const flip = (fn) => curry2((b, a) => fn(a, b));
292
292
  /** @returns first element of an array or a string. */
293
293
  const head = nth(0);
294
- /** @returns last element of an array or a string. */
294
+ /** @returns all elements of an array or a string after first one. */
295
295
  const tail = slice(1, inf);
296
296
  /** Returns last element of an array, readonly array or a string.
297
297
  * @param s Array to extract that element.
@@ -391,7 +391,7 @@ const diff = curry2((_xs1, _xs2) => {
391
391
  const genBy = curry2((generator, length) => [...Array(length)].map((_, i) => generator(i)));
392
392
  const once = (fn) => {
393
393
  let done = false, cache;
394
- return (...args) => {
394
+ return function (...args) {
395
395
  if (done)
396
396
  return cache;
397
397
  done = true;
package/dist/bundle.d.ts CHANGED
@@ -115,7 +115,7 @@ type TailOverload = {
115
115
  ] ? U : T;
116
116
  <T extends any>(s: T[]): null;
117
117
  };
118
- /** @returns last element of an array or a string. */
118
+ /** @returns all elements of an array or a string after first one. */
119
119
  export declare const tail: TailOverload;
120
120
  type LastChar<T extends string> = T extends `${string}${infer Rest}` ? (Split<T>["length"] extends 1 ? T : LastChar<Rest>) : T;
121
121
  type LastOverload = {
@@ -242,12 +242,11 @@ export declare const test: {
242
242
  (a: RegExp): (b: string) => boolean;
243
243
  (a: RegExp, b: string): boolean;
244
244
  };
245
- export declare const tap: {
246
- (a: symbol, b: any): (a: Function) => any;
247
- (a: Function, b: symbol): (b: any) => any;
248
- (a: Function): (b: any) => any;
249
- (a: Function, b: any): any;
245
+ type T_tap = {
246
+ <T>(fn: (x: T) => any, x: T): T;
247
+ (fn: AnyFunc): <T>(x: T) => T;
250
248
  };
249
+ export declare const tap: T_tap;
251
250
  export declare const append: {
252
251
  (a: symbol, b: any[]): (a: any) => any[];
253
252
  (a: any, b: symbol): (b: any[]) => any[];
@@ -325,7 +324,7 @@ export declare const genBy: {
325
324
  };
326
325
  export declare const once: <Func extends AnyFunc>(fn: Func) => (...args: Parameters<Func>) => any;
327
326
  export declare const reverse: <T extends any>(xs: T[]) => T[];
328
- export declare const explore: (caption: string, level?: string) => (b: any) => any;
327
+ export declare const explore: (caption: string, level?: string) => <T>(x: T) => T;
329
328
  export declare const cond: {
330
329
  (a: symbol, b: any): (a: [
331
330
  Cond,
package/dist/bundle.mjs CHANGED
@@ -289,7 +289,7 @@ const slice = curry3((from, to, o) => o.slice(from, (isNum(to) ? to : inf)));
289
289
  const flip = (fn) => curry2((b, a) => fn(a, b));
290
290
  /** @returns first element of an array or a string. */
291
291
  const head = nth(0);
292
- /** @returns last element of an array or a string. */
292
+ /** @returns all elements of an array or a string after first one. */
293
293
  const tail = slice(1, inf);
294
294
  /** Returns last element of an array, readonly array or a string.
295
295
  * @param s Array to extract that element.
@@ -389,7 +389,7 @@ const diff = curry2((_xs1, _xs2) => {
389
389
  const genBy = curry2((generator, length) => [...Array(length)].map((_, i) => generator(i)));
390
390
  const once = (fn) => {
391
391
  let done = false, cache;
392
- return (...args) => {
392
+ return function (...args) {
393
393
  if (done)
394
394
  return cache;
395
395
  done = true;
package/package.json CHANGED
@@ -41,19 +41,19 @@
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.9",
44
+ "version": "1.6.11",
45
45
  "devDependencies": {
46
- "@rollup/plugin-commonjs": "^28.0.6",
47
- "@rollup/plugin-node-resolve": "^16.0.1",
48
- "@rollup/plugin-replace": "^6.0.2",
49
- "@types/node": "^24.1.0",
50
- "cross-env": "^10.0.0",
46
+ "@rollup/plugin-commonjs": "^29.0.0",
47
+ "@rollup/plugin-node-resolve": "^16.0.3",
48
+ "@rollup/plugin-replace": "^6.0.3",
49
+ "@types/node": "^25.0.3",
50
+ "cross-env": "^10.1.0",
51
51
  "dts-bundle-generator": "^9.5.1",
52
- "rollup": "^4.46.0",
52
+ "rollup": "^4.54.0",
53
53
  "rollup-plugin-typescript2": "^0.36.0",
54
54
  "ts-node": "^10.9.2",
55
55
  "tslint": "^6.1.3",
56
- "typescript": "^5.8.3"
56
+ "typescript": "^5.9.3"
57
57
  },
58
58
  "sideEffects": false
59
59
  }
package/src/curry.ts CHANGED
@@ -76,9 +76,9 @@ export function curry2<Func extends Func2>(fn: Func) {
76
76
  throw new Error('Senseless placeholder usage.')
77
77
  return aln>1
78
78
  ? withPlaceholder1
79
- ? endlessph((a: p0) => fn(a, b))
79
+ ? endlessph((a: p0) => fn(a, b) as ReturnType<Func>)
80
80
  : fn(a, b) as ReturnType<Func>
81
- : (b: p1) => fn(a, b)
81
+ : (b: p1) => fn(a, b) as ReturnType<Func>
82
82
  }
83
83
  return curried2
84
84
  }
package/src/safe.ts CHANGED
@@ -72,7 +72,7 @@ type TailOverload = {
72
72
  : T extends readonly [any, ...infer U] ? U : T
73
73
  <T extends any>(s: T[]): null
74
74
  }
75
- /** @returns last element of an array or a string. */
75
+ /** @returns all elements of an array or a string after first one. */
76
76
  export const tail = slice(1, inf) as TailOverload
77
77
  type LastChar<T extends string> = T extends `${string}${infer Rest}`
78
78
  ? (Split<T>['length'] extends 1 ? T : LastChar<Rest>) : T
@@ -128,7 +128,11 @@ export const keys: KeysOverload = (o: any) => Object.keys(o)
128
128
  export const values = (o: AnyObject | any[]) => Object.values(o)
129
129
  export const toPairs = (o: AnyObject | any[]) => Object.entries(o)
130
130
  export const test = curry2((re: RegExp, s: string) => re.test(s))
131
- export const tap = curry2((fn: Function, x: any) => { fn(x); return x })
131
+ type T_tap = {
132
+ <T>(fn: (x: T) => any, x: T): T
133
+ (fn: AnyFunc): <T>(x: T) => T
134
+ }
135
+ export const tap = curry2(<T>(fn: AnyFunc, x: T): T => { fn(x); return x }) as T_tap
132
136
  export const append = curry2((x: any, xs: any[]) => [...xs, x])
133
137
  export const prepend = curry2((x: any, xs: any[]) => [...xs, x])
134
138
  export const flat = (xs: any[]) => xs.flat(inf)
@@ -194,7 +198,7 @@ export const genBy = curry2(
194
198
  )
195
199
  export const once = <Func extends AnyFunc>(fn: Func) => {
196
200
  let done = false, cache: any
197
- return (...args: Parameters<Func>) => {
201
+ return function(...args: Parameters<Func>) {
198
202
  if(done) return cache
199
203
  done = true
200
204
  return cache = fn(...args)