@neovici/cosmoz-utils 6.20.2 → 6.22.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.
package/dist/object.d.ts CHANGED
@@ -2,7 +2,7 @@ import { identity } from './function';
2
2
  export type Rec<K extends PropertyKey = PropertyKey, V = any> = Record<K, V>;
3
3
  export declare function prop(): typeof identity;
4
4
  export declare function prop(a: '' | null | false | undefined | 0): typeof identity;
5
- export declare function prop<K extends PropertyKey>(key?: K): <O>(obj: O) => K extends keyof O ? O[K] : undefined;
5
+ export declare function prop<K extends PropertyKey>(key?: K): <O>(obj: O) => O extends object ? (K extends keyof O ? O[K] : undefined) : O;
6
6
  export declare const strProp: <K extends PropertyKey>(key?: K) => <O>(o: O) => string;
7
7
  export declare const transform: <K extends string, V, RK extends PropertyKey, RV>(obj: Record<K, V>, trans: (entries: [Extract<K, string>, V][]) => Iterable<readonly [RK, RV]>) => { [key in RK]: RV; };
8
8
  export declare const omit: <const K extends readonly PropertyKey[]>(keys: K) => <const T extends Rec>(obj: T) => Omit<T, K[number]>;
package/dist/object.js CHANGED
@@ -3,7 +3,7 @@ export function prop(key) {
3
3
  if (!key) {
4
4
  return identity;
5
5
  }
6
- return (obj) => obj?.[key];
6
+ return (obj) => typeof obj === 'object' && obj !== null ? obj[key] : obj;
7
7
  }
8
8
  export const strProp = (key) => {
9
9
  const p = prop(key);
package/dist/promise.d.ts CHANGED
@@ -10,4 +10,5 @@ export declare const limit$: <T extends unknown[], P>(fn: (...args: T) => Promis
10
10
  export declare const debounce$: <T extends unknown[], P>(fn: (...args: T) => P | PromiseLike<P>, ms?: number) => (...args: T) => Promise<P>;
11
11
  export declare const log$: <T extends unknown[], P>(fn: (...args: T) => PromiseLike<P>) => (...args: T) => PromiseLike<P>;
12
12
  export declare const retry$: <T extends unknown[], P>(fn: (...args: T) => P | PromiseLike<P>, n: number) => (...args: T) => Promise<P>;
13
+ export declare const invoke$: <T, A extends unknown[]>(fn: T | ((...args: A) => T | PromiseLike<T>), ...args: A) => Promise<Awaited<T> | Awaited<T>>;
13
14
  export {};
package/dist/promise.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { invoke } from './function';
1
2
  export class ManagedPromise extends Promise {
2
3
  constructor(callback) {
3
4
  const handles = {};
@@ -84,3 +85,4 @@ export const retry$ = (fn, n) => async (...args) => {
84
85
  }
85
86
  throw error;
86
87
  };
88
+ export const invoke$ = (fn, ...args) => Promise.resolve(invoke(fn, ...args));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-utils",
3
- "version": "6.20.2",
3
+ "version": "6.22.0",
4
4
  "description": "Date, money and template management functions commonly needed in Cosmoz views.",
5
5
  "keywords": [
6
6
  "polymer",
@@ -75,12 +75,14 @@
75
75
  "devDependencies": {
76
76
  "@commitlint/cli": "^19.0.0",
77
77
  "@commitlint/config-conventional": "^19.0.0",
78
- "@neovici/cfg": "^2.8.0",
78
+ "@neovici/cfg": "^2.13.0",
79
79
  "@open-wc/testing": "^4.0.0",
80
+ "@playwright/test": "^1.60.0",
80
81
  "@polymer/polymer": "^3.3.1",
81
82
  "@semantic-release/changelog": "^6.0.0",
82
83
  "@semantic-release/git": "^10.0.0",
83
84
  "@types/mocha": "^10.0.3",
85
+ "@web/test-runner-playwright": "^0.11.1",
84
86
  "husky": "^8.0.0",
85
87
  "lint-staged": "^16.2.7",
86
88
  "lit-html": "^2.0.0 || ^3.0.0",