@neovici/cosmoz-utils 5.8.1 → 5.9.1

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/array.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare function array(): [];
2
2
  export declare function array(arr: null): [];
3
- export declare function array<T>(arr: T[]): T[];
3
+ export declare function array<T>(arr?: T | T[]): T[];
4
4
  export declare function array<T>(arr: Iterable<T>): T[];
5
5
  export declare function array<T = unknown>(arr: T): T[];
6
6
  export declare const without: (exclude: unknown, predicate?: <T>(obj: T) => T) => (list: unknown) => unknown[];
package/dist/array.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable func-style */
2
1
  import { identity } from './function';
3
2
  const isIterable = (x) => {
4
3
  return typeof x === 'object' && x !== null && Symbol.iterator in x;
@@ -2,4 +2,6 @@ type OrFn<T> = (...args: T[]) => boolean;
2
2
  type OnceFn<A, R> = (...args: A[]) => R;
3
3
  type OnceCheckFn<T> = (args: T[]) => boolean | undefined;
4
4
  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, once: <A, R, F extends OnceFn<A, R>>(fn: F, check?: OnceCheckFn<A>) => (...args: A[]) => any;
5
+ export declare function invoke<A, R, F extends (...args: A[]) => R>(fn: F, ...args: A[]): ReturnType<F>;
6
+ export declare function invoke<F>(fn: F, ...args: unknown[]): F;
5
7
  export {};
package/dist/function.js CHANGED
@@ -2,3 +2,6 @@ export const constant = (v) => () => v, constTrue = constant(true), constUndefin
2
2
  let result;
3
3
  return (...args) => (result ??= check(args) ? fn(...args) : undefined);
4
4
  };
5
+ export function invoke(fn, ...args) {
6
+ return typeof fn === 'function' ? fn(...args) : fn;
7
+ }
package/dist/object.js CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable func-style, no-use-before-define, import/group-exports */
1
+ /* eslint-disable no-use-before-define, import/group-exports */
2
2
  import { identity } from './function';
3
3
  export function prop(key) {
4
4
  if (!key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-utils",
3
- "version": "5.8.1",
3
+ "version": "5.9.1",
4
4
  "description": "Date, money and template management functions commonly needed in Cosmoz views.",
5
5
  "keywords": [
6
6
  "polymer",
@@ -80,7 +80,7 @@
80
80
  "@web/test-runner": "^0.15.0",
81
81
  "husky": "^8.0.0",
82
82
  "lit-html": "^2.0.0",
83
- "semantic-release": "^19.0.0",
84
- "sinon": "^14.0.0"
83
+ "semantic-release": "^20.0.0",
84
+ "sinon": "^15.0.0"
85
85
  }
86
86
  }