Socket
Socket
Sign inDemoInstall

object-copy

Package Overview
Dependencies
8
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 1.0.0

README.md

20

index.js

@@ -18,6 +18,12 @@ 'use strict';

* copy(obj, proto);
*
* // filter out keys
* copy(obj, proto, function(key) {
* return key !== 'index';
* });
* ```
* @param {Object} `receiver`
* @param {Object} `provider`
* @param {String|Array} `omit` One or more properties to omit
* @param {String|Array} `omit` (optional) One or more properties to omit
* @param {Function} `filter` (optional) Called on each key before copying the property. If the function returns false, the property will not be copied.
* @return {Object}

@@ -27,3 +33,3 @@ * @api public

function copy(receiver, provider, omit) {
function copy(receiver, provider, omit, fn) {
if (!isObject(receiver)) {

@@ -36,2 +42,7 @@ throw new TypeError('expected receiving object to be an object.');

if (typeof omit === 'function') {
fn = omit;
omit = [];
}
var props = nativeKeys(provider);

@@ -44,2 +55,5 @@ var keys = Object.keys(provider);

var key = props[len];
if (typeof fn === 'function' && fn(key) === false) {
continue;
}

@@ -64,3 +78,3 @@ if (has(keys, key)) {

* Returns true if an array has any of the given elements, or an
* object has any of the give keys.
* object has any of the given keys.
*

@@ -67,0 +81,0 @@ * ```js

18

package.json
{
"name": "object-copy",
"description": "Copy static properties, prototype properties, and descriptors from one object to another.",
"version": "0.1.0",
"version": "1.0.0",
"homepage": "https://github.com/jonschlinkert/object-copy",

@@ -23,9 +23,9 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"copy-descriptor": "^0.1.0",
"define-property": "^0.2.5",
"kind-of": "^3.0.3"
"copy-descriptor": "^0.1.1",
"define-property": "^1.0.0",
"kind-of": "^5.0.0"
},
"devDependencies": {
"gulp-format-md": "*",
"mocha": "*"
"gulp-format-md": "^0.1.12",
"mocha": "^3.4.2"
},

@@ -42,3 +42,7 @@ "keywords": [

"related": {
"list": []
"list": [
"copy-descriptor",
"define-property",
"kind-of"
]
},

@@ -45,0 +49,0 @@ "reflinks": [

Sorry, the diff of this file is not supported yet

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