@neovici/cosmoz-utils 6.1.0 → 6.2.0

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.
@@ -2,7 +2,9 @@ type OrFn<T> = (...args: T[]) => boolean;
2
2
  type Arr = any[];
3
3
  type OnceFn<A extends Arr, R> = (...args: A) => R;
4
4
  type OnceCheckFn<A extends Arr> = (args: A) => boolean | undefined;
5
- export declare const constant: <T>(v?: T | undefined) => () => T | undefined, constTrue: () => boolean | undefined, constUndefined: () => unknown, noop: () => unknown, identity: <T>(obj: T) => T, or: <A, F extends OrFn<A>>(...fns: F[]) => (...args: A[]) => boolean;
5
+ export declare function constant(): () => undefined;
6
+ export declare function constant<T>(v: T): () => T;
7
+ export declare const constTrue: () => true, constUndefined: () => undefined, noop: () => undefined, identity: <T>(obj: T) => T, or: <A, F extends OrFn<A>>(...fns: F[]) => (...args: A[]) => boolean;
6
8
  export declare const once: <A extends Arr, R, F extends OnceFn<A, R> = OnceFn<A, R>>(fn: F, check?: OnceCheckFn<A>) => (...args: A) => any;
7
9
  export declare function invoke<A, R, F extends (...args: A[]) => R>(fn: F, ...args: A[]): ReturnType<F>;
8
10
  export declare function invoke<F>(fn: F, ...args: unknown[]): F;
package/dist/function.js CHANGED
@@ -1,4 +1,7 @@
1
- export const constant = (v) => () => v, constTrue = constant(true), constUndefined = constant(), noop = constUndefined, identity = (obj) => obj, or = (...fns) => (...args) => fns.reduce((res, fn) => res || fn(...args), false);
1
+ export function constant(v) {
2
+ return () => v;
3
+ }
4
+ export const constTrue = constant(true), constUndefined = constant(), noop = constUndefined, identity = (obj) => obj, or = (...fns) => (...args) => fns.reduce((res, fn) => res || fn(...args), false);
2
5
  export const once = (fn, check = constTrue) => {
3
6
  let result;
4
7
  return (...args) => (result ??= check(args) ? fn(...args) : undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-utils",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "description": "Date, money and template management functions commonly needed in Cosmoz views.",
5
5
  "keywords": [
6
6
  "polymer",