@loadmill/universal 0.3.133 → 0.3.135

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.
@@ -25,3 +25,4 @@ export declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<
25
25
  * Make all properties in T optional except a set of properties K
26
26
  */
27
27
  export declare type PartialWithExcludes<T, K extends keyof T> = Pick<T, K> & Partial<T>;
28
+ export declare function filterWithTypeGuard<T, S extends T>(array: T[], predicate: (item: T) => item is S): S[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensure = void 0;
3
+ exports.filterWithTypeGuard = exports.ensure = void 0;
4
4
  /**
5
5
  * example usage of this function:
6
6
  * arr = [{ id: 1 }, { id: 2 }]
@@ -20,4 +20,8 @@ function ensure(arg, msg) {
20
20
  return arg;
21
21
  }
22
22
  exports.ensure = ensure;
23
+ function filterWithTypeGuard(array, predicate) {
24
+ return array.filter(predicate);
25
+ }
26
+ exports.filterWithTypeGuard = filterWithTypeGuard;
23
27
  //# sourceMappingURL=typescript-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-utils.js","sourceRoot":"","sources":["../src/typescript-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAI,GAAc,EAAE,GAAqD;IAArD,oBAAA,EAAA,6CAAqD;IAC7F,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;KAC1B;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAND,wBAMC"}
1
+ {"version":3,"file":"typescript-utils.js","sourceRoot":"","sources":["../src/typescript-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAI,GAAc,EAAE,GAAqD;IAArD,oBAAA,EAAA,6CAAqD;IAC7F,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;KAC1B;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAND,wBAMC;AA2BD,SAAgB,mBAAmB,CAAiB,KAAU,EAAE,SAAiC;IAC/F,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAFD,kDAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadmill/universal",
3
- "version": "0.3.133",
3
+ "version": "0.3.135",
4
4
  "description": "Loadmill universal utilities",
5
5
  "main": "dist/",
6
6
  "types": "dist/index.d.ts",