pepka 1.6.7 → 1.6.9

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
@@ -440,7 +440,7 @@ const clone = (s, shallow = false) => {
440
440
  const t = type(s);
441
441
  switch (t) {
442
442
  case 'Null': return s;
443
- case 'Array': return shallow ? [...s] : map(compose(clone, take(0)), s);
443
+ case 'Array': return (shallow ? [...s] : map(compose(clone, take(0)), s));
444
444
  case 'Object':
445
445
  if (shallow)
446
446
  return { ...s };
package/dist/bundle.d.ts CHANGED
@@ -391,7 +391,7 @@ export declare const path: any;
391
391
  export declare const pathEq: (...args: AnyArgs) => any;
392
392
  export declare const pathsEq: (...args: AnyArgs) => any;
393
393
  export declare const pathExists: Composed<any[], any>;
394
- export declare const clone: (s: any, shallow?: boolean) => any;
394
+ export declare const clone: <T extends any>(s: T, shallow?: boolean) => T;
395
395
  export declare const cloneShallow: (s: any) => any;
396
396
  export declare const freeze: <T extends AnyObject>(o: T) => Readonly<T>;
397
397
  export declare const freezeShallow: <T extends AnyObject>(o: T) => Readonly<T>;
@@ -444,10 +444,26 @@ export declare const mapObj: {
444
444
  (a: (s: any, i?: string, list?: any[]) => any, b: AnyObject): AnyObject;
445
445
  };
446
446
  export declare const join: {
447
- (a: symbol, b: any[]): (a: string) => string;
448
- (a: string, b: symbol): (b: any[]) => string;
449
- (a: string): (b: any[]) => string;
450
- (a: string, b: any[]): string;
447
+ (a: symbol, b: ArrayLike<any> & {
448
+ join: AnyFunc<string, [
449
+ delim: string
450
+ ]>;
451
+ }): (a: string) => string;
452
+ (a: string, b: symbol): (b: ArrayLike<any> & {
453
+ join: AnyFunc<string, [
454
+ delim: string
455
+ ]>;
456
+ }) => string;
457
+ (a: string): (b: ArrayLike<any> & {
458
+ join: AnyFunc<string, [
459
+ delim: string
460
+ ]>;
461
+ }) => string;
462
+ (a: string, b: ArrayLike<any> & {
463
+ join: AnyFunc<string, [
464
+ delim: string
465
+ ]>;
466
+ }): string;
451
467
  };
452
468
  export declare const forEach: {
453
469
  (a: symbol, b: any[]): (a: (s: unknown, i: number, arr: unknown[]) => any) => void;
package/dist/bundle.mjs CHANGED
@@ -438,7 +438,7 @@ const clone = (s, shallow = false) => {
438
438
  const t = type(s);
439
439
  switch (t) {
440
440
  case 'Null': return s;
441
- case 'Array': return shallow ? [...s] : map(compose(clone, take(0)), s);
441
+ case 'Array': return (shallow ? [...s] : map(compose(clone, take(0)), s));
442
442
  case 'Object':
443
443
  if (shallow)
444
444
  return { ...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.7",
44
+ "version": "1.6.9",
45
45
  "devDependencies": {
46
46
  "@rollup/plugin-commonjs": "^28.0.6",
47
47
  "@rollup/plugin-node-resolve": "^16.0.1",
package/src/safe.ts CHANGED
@@ -265,21 +265,21 @@ export const pathsEq = curry3(
265
265
  equals(path(_path, o1), path(_path, o2))
266
266
  )
267
267
  export const pathExists = compose(ifElse(equals(symbol), F, T), pathOr(symbol))
268
- export const clone = (s: any, shallow = false) => {
268
+ export const clone = <T extends any>(s: T, shallow = false): T => {
269
269
  const t = type(s)
270
270
  switch(t) {
271
271
  case 'Null': return s
272
- case 'Array': return shallow ? [...s] : map(compose(clone, take(0)), s)
272
+ case 'Array': return (shallow ? [...(s as any[])] : map(compose(clone, take(0)), s as any[])) as T
273
273
  case 'Object':
274
- if(shallow) return {...s}
275
- const out = {}
274
+ if(shallow) return {...s as AnyObject} as T
275
+ const out: AnyObject = {}
276
276
  for(let k in s) out[k] = clone(s[k])
277
- return out
277
+ return out as T
278
278
  case 'String': case 'Number':
279
279
  case 'Boolean': case 'Symbol':
280
280
  return s
281
281
  default:
282
- return is_typed_arr(t) ? s.constructor.from(s) : s
282
+ return is_typed_arr(t) ? (s as any).constructor.from(s) : s
283
283
  }
284
284
  }
285
285
  export const cloneShallow = (s: any) => clone(s, true)
@@ -323,7 +323,9 @@ export const map = curry2(
323
323
  export const mapObj = curry2(
324
324
  (pipe: (s: any, i?: string, list?: any[]) => any, o: AnyObject) => qmapObj(pipe, {...o})
325
325
  )
326
- export const join = curry2((delimeter: string, arr: any[]) => arr.join(delimeter))
326
+ export const join = curry2(
327
+ (delimeter: string, arr: ArrayLike<any>&{join: AnyFunc<string, [delim: string]>}) => arr.join(delimeter)
328
+ )
327
329
  export const forEach = curry2(<T extends any>(pipe: (s: T, i: number, arr: T[]) => any, arr: any[]) => arr.forEach(pipe))
328
330
  export const both = curry3((cond1: Cond, cond2: Cond, s: any) => cond2(s) && cond1(s))
329
331
  export const isEmpty = (s: any) => {