Socket
Socket
Sign inDemoInstall

pick-util

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-0 to 1.0.0

8

package.json
{
"name": "pick-util",
"version": "1.0.0-0",
"version": "1.0.0",
"description": "Return a copy of the object only containing the whitelisted properties.",
"main": "index.js",
"scripts": {
"build": "node build",
"build": "rollup --config",
"prepublishOnly": "npm run build",

@@ -34,5 +34,7 @@ "lint": "eslint . --max-warnings 0",

"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"eslint": "^6.8.0",
"mocha": "^7.0.1",
"umd-util": "^2.0.0"
"rollup": "^1.31.1"
},

@@ -39,0 +41,0 @@ "dependencies": {

@@ -1,60 +0,57 @@

(function(f) {
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f()
} else if (typeof define === "function" && define.amd) {
define([], f)
} else {
var g;
if (typeof window !== "undefined") {
g = window
} else if (typeof global !== "undefined") {
g = global
} else if (typeof self !== "undefined") {
g = self
} else {
g = this
}
g.pick = f()
}
})(function() {
var define, module, exports;
module = {
exports: (exports = {})
};
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.pick = factory());
}(this, (function () { 'use strict';
const flatten = require('flat-util');
function flatten(array, result) {
for (let i = 0; i < array.length; i++) {
const value = array[i];
if (Array.isArray(value)) {
flatten(value, result);
} else {
result.push(value);
}
}
}
const isFunction = obj => toString.call(obj) === '[object Function]';
var flatUtil = function (array) {
const result = [];
flatten(array, result);
return result;
};
const keyInObj = (value, key, obj) => key in obj;
const isFunction = obj => toString.call(obj) === '[object Function]';
module.exports = (obj, ...keys) => {
const result = {};
let iteratee = keys[0];
const keyInObj = (value, key, obj) => key in obj;
if (!obj) {
return result;
}
var pickUtil = (obj, ...keys) => {
const result = {};
let iteratee = keys[0];
if (isFunction(iteratee)) {
keys = Object.keys(obj);
} else {
iteratee = keyInObj;
keys = flatten(keys);
obj = Object(obj);
}
if (!obj) {
return result;
}
keys.forEach(key => {
const value = obj[key];
if (iteratee(value, key, obj)) {
result[key] = value;
if (isFunction(iteratee)) {
keys = Object.keys(obj);
} else {
iteratee = keyInObj;
keys = flatUtil(keys);
obj = Object(obj);
}
});
return result;
};
keys.forEach(key => {
const value = obj[key];
if (iteratee(value, key, obj)) {
result[key] = value;
}
});
return module.exports;
});
return result;
};
return pickUtil;
})));
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc