mixin-object
Advanced tools
Comparing version 0.1.1 to 1.0.0
29
index.js
/*! | ||
* mixin-object <https://github.com/jonschlinkert/mixin-object> | ||
* | ||
* Copyright (c) 2014 Jon Schlinkert, contributors. | ||
* Licensed under the MIT License | ||
* Copyright (c) 2014-2015, Jon Schlinkert. | ||
* Licensed under the MIT License. | ||
*/ | ||
@@ -10,16 +10,10 @@ | ||
var forOwn = require('for-own'); | ||
var isObject = require('is-plain-object'); | ||
var forIn = require('for-in'); | ||
module.exports = function mixIn(o) { | ||
var args = [].slice.call(arguments); | ||
var len = args.length; | ||
module.exports = function mixin(o, objects) { | ||
if (!o || !objects) { return o || {}; } | ||
if (o == null) { | ||
return {}; | ||
} | ||
var len = arguments.length - 1; | ||
if (len === 0) { | ||
return o; | ||
} | ||
function copy(value, key) { | ||
@@ -30,8 +24,9 @@ this[key] = value; | ||
for (var i = 0; i < len; i++) { | ||
var obj = args[i]; | ||
if (obj != null) { | ||
forOwn(obj, copy, o); | ||
var obj = arguments[i + 1]; | ||
if (isObject(obj)) { | ||
forIn(obj, copy, o); | ||
} | ||
} | ||
return o; | ||
}; | ||
}; |
{ | ||
"name": "mixin-object", | ||
"description": "Extend the properties from any number of objects onto the first object. Pass an empty object as the first arg to create a new object.", | ||
"version": "0.1.1", | ||
"description": "Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone.", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/jonschlinkert/mixin-object", | ||
@@ -17,7 +17,8 @@ "author": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/mixin-object/blob/master/LICENSE-MIT" | ||
} | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/mixin-object/blob/master/LICENSE" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
@@ -29,15 +30,26 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"for-in": "^0.1.3", | ||
"for-own": "^0.1.1", | ||
"is-plain-object": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"verb-tag-jscomments": ">= 0.2.0", | ||
"verb": ">= 0.2.6", | ||
"mocha": "*" | ||
"mocha": "*", | ||
"should": "^5.0.1" | ||
}, | ||
"keywords": [ | ||
"mixin" | ||
], | ||
"dependencies": { | ||
"for-own": "^0.1.1" | ||
} | ||
"copy", | ||
"extend", | ||
"key", | ||
"merge", | ||
"mixin", | ||
"object", | ||
"prop", | ||
"properties", | ||
"property", | ||
"util", | ||
"value" | ||
] | ||
} |
# mixin-object [![NPM version](https://badge.fury.io/js/mixin-object.svg)](http://badge.fury.io/js/mixin-object) | ||
> Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone. | ||
> Extend the properties from any number of objects onto the first object. Pass an empty object as the first arg to create a new object. | ||
If you only want to combine own-properties, use [extend-shallow](https://github.com/jonschlinkert/extend-shallow). | ||
## Install | ||
#### Install with [npm](npmjs.org): | ||
## Install with [npm](npmjs.org) | ||
```bash | ||
npm i mixin-object --save-dev | ||
npm i mixin-object --save | ||
``` | ||
## Run tests | ||
```bash | ||
npm test | ||
``` | ||
## Usage | ||
@@ -34,2 +28,10 @@ | ||
## Running tests | ||
Install dev dependencies. | ||
```bash | ||
npm i -d && npm test | ||
``` | ||
## Author | ||
@@ -54,2 +56,3 @@ | ||
- [delete](https://github.com/jonschlinkert/delete) | ||
- [extend-shallow](https://github.com/jonschlinkert/extend-shallow) | ||
- [for-in](https://github.com/jonschlinkert/for-in) | ||
@@ -68,3 +71,3 @@ - [for-own](https://github.com/jonschlinkert/for-own) | ||
## License | ||
Copyright (c) 2014 Jon Schlinkert, contributors. | ||
Copyright (c) 2015 Jon Schlinkert | ||
Released under the MIT license | ||
@@ -74,2 +77,2 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 01, 2014._ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on February 25, 2015._ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
0
74
5219
3
4
23
+ Addedfor-in@^0.1.3
+ Addedis-plain-object@^1.0.0
+ Addedfor-in@0.1.8(transitive)
+ Addedis-plain-object@1.0.0(transitive)
+ Addedisobject@0.2.0(transitive)