Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extendr

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extendr - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

es5/lib/extendr.js

20

LICENSE.md

@@ -1,6 +0,16 @@

(The MIT License)
Copyright © 2013+ [Bevry Pty Ltd](http://bevry.me) <us@bevry.me>
Copyright © 2011-2012 [Benjamin Lupton](http://balupton.com) <b@lupton.cc>
<!-- LICENSEFILE/ -->
# License
Unless stated otherwise all works are:
- Copyright &copy; 2013+ Bevry Pty Ltd <us@bevry.me> (https://bevry.me)
- Copyright &copy; 2011-2012 Benjamin Lupton <b@lupton.cc> (https://balupton.com)
and licensed under:
- The incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://opensource.org/licenses/mit-license.php)
## MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@@ -11,1 +21,5 @@

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<!-- /LICENSEFILE -->

118

package.json
{
"name": "extendr",
"version": "2.1.0",
"description": "Utilities for cloning, extending, and de-referencing objects in shallow, deep, and safe ways",
"homepage": "https://github.com/bevry/extendr",
"keywords": [
"extend","deepExtend","shallowExtend","safeExtend","clone","deepClone","dereference"
],
"author": "Bevry Pty Ltd <us@bevry.me> (http://bevry.me)",
"maintainers": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"bugs": {
"url": "https://github.com/bevry/extendr/issues"
},
"repository" : {
"type": "git",
"url": "http://github.com/bevry/extendr.git"
},
"engines" : {
"node": ">=0.4"
},
"dependencies": {
"typechecker": "~2.0.1"
},
"devDependencies": {
"coffee-script": "~1.6.2",
"joe": "~1.2.0",
"joe-reporter-console": "~1.2.1",
"chai": "~1.7.2"
},
"directories": {
"lib": "./out/lib"
},
"scripts": {
"test": "node ./out/test/extendr-test.js"
},
"main": "./out/lib/extendr.js"
}
"name": "extendr",
"version": "3.0.0",
"description": "Utilities for cloning, extending, and de-referencing objects in shallow, deep, and safe ways",
"homepage": "https://github.com/bevry/extendr",
"license": {
"type": "MIT"
},
"keywords": [
"extend",
"deepExtend",
"shallowExtend",
"safeExtend",
"clone",
"deepClone",
"dereference"
],
"badges": {
"travis": true,
"npm": true,
"npmdownloads": true,
"david": true,
"daviddev": true,
"gratipay": "bevry",
"flattr": "344188/balupton-on-Flattr",
"paypal": "QB8GQPZAH84N6",
"bitcoin": "https://bevry.me/bitcoin",
"wishlist": "https://bevry.me/wishlist"
},
"author": "2013+ Bevry Pty Ltd <us@bevry.me> (https://bevry.me), 2011-2012 Benjamin Lupton <b@lupton.cc> (https://balupton.com)",
"maintainers": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)",
"sfrdmn (https://github.com/sfrdmn)"
],
"bugs": {
"url": "https://github.com/bevry/extendr/issues"
},
"repository": {
"type": "git",
"url": "http://github.com/bevry/extendr.git"
},
"browsers": true,
"engines": {
"node": ">=0.12"
},
"dependencies": {
"typechecker": "^3.0.0"
},
"devDependencies": {
"assert-helpers": "^3.0.0",
"babel": "^5.8.23",
"babel-eslint": "^4.1.1",
"eslint": "^1.3.1",
"joe": "^1.6.0",
"joe-reporter-console": "^1.2.1",
"projectz": "^0.5.0"
},
"main": "./esnextguardian.js",
"scripts": {
"clean": "node --harmony nakefile.js clean",
"setup": "node --harmony nakefile.js setup",
"compile": "node --harmony nakefile.js compile",
"watch": "node --harmony nakefile.js watch",
"verify": "node --harmony nakefile.js verify",
"meta": "node --harmony nakefile.js meta",
"prepare": "node --harmony nakefile.js prepare",
"release": "node --harmony nakefile.js release",
"test": "node --harmony ./es5/test/extendr-test.js"
},
"nakeConfiguration": {
"BABEL_SRC_PATH": "esnext",
"ESLINT_SRC_PATH": "esnext",
"YUIDOC_SRC_PATH": "esnext"
}
}

@@ -1,77 +0,128 @@

# Extendr
<!-- TITLE -->
[![Build Status](https://secure.travis-ci.org/bevry/extendr.png?branch=master)](http://travis-ci.org/bevry/extendr)
[![NPM version](https://badge.fury.io/js/extendr.png)](https://npmjs.org/package/extendr)
[![Flattr this project](https://raw.github.com/balupton/flattr-buttons/master/badge-89x18.gif)](http://flattr.com/thing/344188/balupton-on-Flattr)
<!-- BADGES/ -->
[![Build Status](https://img.shields.io/travis/bevry/extendr/master.svg)](http://travis-ci.org/bevry/extendr "Check this project's build status on TravisCI")
[![NPM version](https://img.shields.io/npm/v/extendr.svg)](https://npmjs.org/package/extendr "View this project on NPM")
[![NPM downloads](https://img.shields.io/npm/dm/extendr.svg)](https://npmjs.org/package/extendr "View this project on NPM")
[![Dependency Status](https://img.shields.io/david/bevry/extendr.svg)](https://david-dm.org/bevry/extendr)
[![Dev Dependency Status](https://img.shields.io/david/dev/bevry/extendr.svg)](https://david-dm.org/bevry/extendr#info=devDependencies)<br/>
[![Gratipay donate button](https://img.shields.io/gratipay/bevry.svg)](https://www.gratipay.com/bevry/ "Donate weekly to this project using Gratipay")
[![Flattr donate button](https://img.shields.io/badge/flattr-donate-yellow.svg)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
[![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
[![BitCoin donate button](https://img.shields.io/badge/bitcoin-donate-yellow.svg)](https://bevry.me/bitcoin "Donate once-off to this project using BitCoin")
[![Wishlist browse button](https://img.shields.io/badge/wishlist-donate-yellow.svg)](https://bevry.me/wishlist "Buy an item on our wishlist for us")
<!-- /BADGES -->
<!-- DESCRIPTION/ -->
Utilities for cloning, extending, and de-referencing objects in shallow, deep, and safe ways
<!-- /DESCRIPTION -->
<!-- INSTALL/ -->
## Install
### Backend
### [NPM](http://npmjs.org/)
- Use: `require('extendr')`
- Install: `npm install --save extendr`
1. [Install Node.js](http://bevry.me/node/install)
2. `npm install --save extendr`
### [Browserify](http://browserify.org/)
- Use: `require('extendr')`
- Install: `npm install --save extendr`
- CDN URL: `//wzrd.in/bundle/extendr@3.0.0`
### Frontend
### [Ender](http://enderjs.com)
- Use: `require('extendr')`
- Install: `ender add extendr`
1. [See Browserify](http://browserify.org)
<!-- /INSTALL -->
## Usage
### Example
### API
``` javascript
// Shallow Clone
(function(){
var a = {a:1}, b = {b:2}
var c = require('extendr').clone(a,b)
console.log(a) // {a:1}
console.log(b) // {b:2}
console.log(c) // {a:1,b:2}
})()
- `require('extendr').extend(target, ...objects)` - shallow extend the properties from the objects into the target
- `require('extendr').deep(target, ...objects)` - deep extend the properties from the objects into the target
- `require('extendr').defaults(target, ...objects)` - shallow extend the properties from the objects into the target where the target's value is undefined or null
- `require('extendr').deepDefaults(target, ...objects)` - deep extend the properties from the objects into the target where the target's value is undefined or null
- `require('extendr').clone(...objects)` - deep extend the properties from the objects into a new object
- `require('extendr').dereferenceJSON(object)` - clones the object by stringifg it, then parsing the result, to ensure all references are destroyed (objects that not plain objects or arrays will be lost)
// Shallow Extend
(function(){
var a = {a:1}, b = {b:2}
var c = require('extendr').extend(a,b)
console.log(a) // {a:1,b:2}
console.log(b) // {b:2}
console.log(c) // {a:1,b:2}
})()
```
### Methods
### Implementation
- `clone(args...)` - shallow extend the arguments into a new object, same as `extend({},args...)`
- `deepClone(args...)` - deep extend the arguments into a new object, same as `deepExtend({},args...)`
- `dereference(obj)` - return a copy of the object with all references destroyed, same as serializing then deserializing the object
- `extend(args...)` - alias for `shallowExtendPlainObjects`
- `deepExtend(args...)` - alias for `deepExtendPlainObjects`
- `shallowExtendPlainObjects(target, args...)` - shallow extend the arguments into the target
- `deepExtendPlainObjects(target, args...)` - deep extend the arguments into the target
- `safeShallowExtendPlainObjects(target, objs...)` - shallow extend defined values from the arguments into the target
- `safeDeepExtendPlainObjects(target, args...)` - deep extend defined values from the arguments into the target
- Extendr arguments can only be plain JavaScript objects, anything else will throw. This is intentional to guarantee consistency of references.
- Object property values that are plain objects or arrays will be dereferenced. All other object types will keep their reference.
### Notes
- Use the clone methods when you don't want to modify your first object
- Use the extend methods when you want to modify the first argument
- Use the dereference method when you want to make sure that nothing has any references to the old object
- Use the safe methods when you don't want `null` and `undefined` values to overwrite a defined values
<!-- HISTORY/ -->
## History
[Discover the change history by heading on over to the `HISTORY.md` file.](https://github.com/bevry/extendr/blob/master/HISTORY.md#files)
<!-- /HISTORY -->
## History
You can discover the history inside the [History.md](https://github.com/bevry/extendr/blob/master/History.md#files) file
<!-- CONTRIBUTE/ -->
## Contribute
[Discover how you can contribute by heading on over to the `CONTRIBUTING.md` file.](https://github.com/bevry/extendr/blob/master/CONTRIBUTING.md#files)
<!-- /CONTRIBUTE -->
<!-- BACKERS/ -->
## Backers
### Maintainers
These amazing people are maintaining this project:
- Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)
### Sponsors
No sponsors yet! Will you be the first?
[![Gratipay donate button](https://img.shields.io/gratipay/bevry.svg)](https://www.gratipay.com/bevry/ "Donate weekly to this project using Gratipay")
[![Flattr donate button](https://img.shields.io/badge/flattr-donate-yellow.svg)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
[![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
[![BitCoin donate button](https://img.shields.io/badge/bitcoin-donate-yellow.svg)](https://bevry.me/bitcoin "Donate once-off to this project using BitCoin")
[![Wishlist browse button](https://img.shields.io/badge/wishlist-donate-yellow.svg)](https://bevry.me/wishlist "Buy an item on our wishlist for us")
### Contributors
These amazing people have contributed code to this project:
- [Benjamin Lupton](https://github.com/balupton) <b@lupton.cc> — [view contributions](https://github.com/bevry/extendr/commits?author=balupton)
- [sfrdmn](https://github.com/sfrdmn) — [view contributions](https://github.com/bevry/extendr/commits?author=sfrdmn)
[Become a contributor!](https://github.com/bevry/extendr/blob/master/CONTRIBUTING.md#files)
<!-- /BACKERS -->
<!-- LICENSE/ -->
## License
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright © 2013+ [Bevry Pty Ltd](http://bevry.me)
<br/>Copyright © 2011-2012 [Benjamin Arthur Lupton](http://balupton.com)
Unless stated otherwise all works are:
- Copyright &copy; 2013+ Bevry Pty Ltd <us@bevry.me> (https://bevry.me)
- Copyright &copy; 2011-2012 Benjamin Lupton <b@lupton.cc> (https://balupton.com)
and licensed under:
- The incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://opensource.org/licenses/mit-license.php)
<!-- /LICENSE -->

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc