@contrail/util 1.1.11-alpha-1 → 1.1.12

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.
@@ -1,8 +1,8 @@
1
1
  export declare function retainOnlyProperties<T extends Record<string, any>, K extends readonly string[]>(obj: T[], keysToKeep: K, options?: {
2
2
  shouldDeleteInPlace?: boolean;
3
- shouldSkipKeys?: readonly string[];
3
+ skipKeys?: readonly string[];
4
4
  }): Array<Pick<T, K[number]>>;
5
5
  export declare function retainOnlyProperties<T extends Record<string, any>, K extends readonly string[]>(obj: T, keysToKeep: K, options?: {
6
6
  shouldDeleteInPlace?: boolean;
7
- shouldSkipKeys?: readonly string[];
7
+ skipKeys?: readonly string[];
8
8
  }): Pick<T, K[number]>;
@@ -2,12 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.retainOnlyProperties = void 0;
4
4
  const object_util_1 = require("../object-util");
5
- function retainOnlyProperties(obj, keysToKeep, options = {
6
- shouldDeleteInPlace: false,
7
- shouldSkipKeys: [],
8
- }) {
5
+ function retainOnlyProperties(obj, keysToKeep, options = {}) {
9
6
  const keepSet = new Set(keysToKeep);
10
- const skipSet = new Set(options.shouldSkipKeys || []);
7
+ const skipSet = new Set(options.skipKeys || []);
11
8
  const shouldReturnAsIs = (value) => value === null || value === undefined || typeof value !== 'object' || value instanceof Date;
12
9
  const retain = (target) => {
13
10
  if (shouldReturnAsIs(target))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/util",
3
- "version": "1.1.11-alpha-1",
3
+ "version": "1.1.12",
4
4
  "description": "General javascript utilities",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",