@antfu/utils
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -216,3 +216,3 @@ /** | ||
*/ | ||
declare function objectPick<O, T extends keyof O>(obj: O, keys: T[]): Pick<O, T>; | ||
declare function objectPick<O, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>; | ||
@@ -219,0 +219,0 @@ interface SingletonPromiseReturn<T> { |
@@ -154,5 +154,8 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/array.ts | ||
} | ||
function objectPick(obj, keys) { | ||
function objectPick(obj, keys, omitUndefined = false) { | ||
return keys.reduce((n, k) => { | ||
n[k] = obj[k]; | ||
if (k in obj) { | ||
if (!omitUndefined || !obj[k] === void 0) | ||
n[k] = obj[k]; | ||
} | ||
return n; | ||
@@ -159,0 +162,0 @@ }, {}); |
{ | ||
"name": "@antfu/utils", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Opinionated collection of common JavaScript / TypeScript utils by @antfu", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20232
630