mixin-deep 1.1.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mixin-deep might be problematic. Click here for more details.

Files changed (4) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +45 -27
  3. package/index.js +25 -18
  4. package/package.json +28 -6
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2015, Jon Schlinkert.
3
+ Copyright (c) 2014-2015, 2017, Jon Schlinkert.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,19 +1,15 @@
1
- # mixin-deep [![NPM version](https://badge.fury.io/js/mixin-deep.svg)](http://badge.fury.io/js/mixin-deep)
1
+ # mixin-deep [![NPM version](https://img.shields.io/npm/v/mixin-deep.svg?style=flat)](https://www.npmjs.com/package/mixin-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/mixin-deep.svg?style=flat)](https://npmjs.org/package/mixin-deep) [![NPM total downloads](https://img.shields.io/npm/dt/mixin-deep.svg?style=flat)](https://npmjs.org/package/mixin-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/mixin-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/mixin-deep)
2
2
 
3
3
  > Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
4
4
 
5
- ## Install
6
-
7
- Install with [npm](https://www.npmjs.com/)
5
+ Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
8
6
 
9
- ```sh
10
- $ npm i mixin-deep --save
11
- ```
7
+ ## Install
12
8
 
13
- Install with [bower](http://bower.io/)
9
+ Install with [npm](https://www.npmjs.com/):
14
10
 
15
11
  ```sh
16
- $ bower install mixin-deep --save
12
+ $ npm install --save mixin-deep
17
13
  ```
18
14
 
19
15
  ## Usage
@@ -25,38 +21,60 @@ mixinDeep({a: {aa: 'aa'}}, {a: {bb: 'bb'}}, {a: {cc: 'cc'}});
25
21
  //=> { a: { aa: 'aa', bb: 'bb', cc: 'cc' } }
26
22
  ```
27
23
 
28
- ## Related projects
24
+ ## About
25
+
26
+ <details>
27
+ <summary><strong>Contributing</strong></summary>
29
28
 
30
- * [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object.
31
- * [defaults-deep](https://github.com/jonschlinkert/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object.
32
- * [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util.
33
- * [merge-deep](https://github.com/jonschlinkert/merge-deep): Recursively merge values in a javascript object.
34
- * [omit-deep](https://github.com/jonschlinkert/omit-deep): Recursively omit the specified key or keys from an object.
29
+ Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
35
30
 
36
- ## Running tests
31
+ </details>
37
32
 
38
- Install dev dependencies:
33
+ <details>
34
+ <summary><strong>Running Tests</strong></summary>
35
+
36
+ Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
39
37
 
40
38
  ```sh
41
- $ npm i -d && npm test
39
+ $ npm install && npm test
42
40
  ```
43
41
 
44
- ## Contributing
42
+ </details>
43
+ <details>
44
+ <summary><strong>Building docs</strong></summary>
45
+
46
+ _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
47
+
48
+ To generate the readme, run the following command:
49
+
50
+ ```sh
51
+ $ npm install -g verbose/verb#dev verb-generate-readme && verb
52
+ ```
53
+
54
+ </details>
55
+
56
+ ### Related projects
57
+
58
+ You might also be interested in these projects:
45
59
 
46
- Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/mixin-deep/issues/new)
60
+ * [defaults-deep](https://www.npmjs.com/package/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object. | [homepage](https://github.com/jonschlinkert/defaults-deep "Like `extend` but recursively copies only the missing properties/values to the target object.")
61
+ * [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
62
+ * [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
63
+ * [mixin-object](https://www.npmjs.com/package/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://github.com/jonschlinkert/mixin-object) | [homepage](https://github.com/jonschlinkert/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.")
47
64
 
48
- ## Author
65
+ ### Author
49
66
 
50
67
  **Jon Schlinkert**
51
68
 
52
- + [github/jonschlinkert](https://github.com/jonschlinkert)
53
- + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
69
+ * [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
70
+ * [github/jonschlinkert](https://github.com/jonschlinkert)
71
+ * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
54
72
 
55
- ## License
73
+ ### License
56
74
 
57
- Copyright © 2015 Jon Schlinkert
58
- Released under the MIT license.
75
+ Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
76
+ Released under the [MIT License](LICENSE).
59
77
 
60
78
  ***
61
79
 
62
- _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 28, 2015._
80
+ _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 09, 2017._
package/index.js CHANGED
@@ -1,40 +1,47 @@
1
1
  'use strict';
2
2
 
3
- var isObject = require('is-plain-object');
4
- var forOwn = require('for-own');
3
+ var isExtendable = require('is-extendable');
4
+ var forIn = require('for-in');
5
5
 
6
- function mixinDeep(o, objects) {
7
- if (!isObject(o)) return {};
8
- if (!isObject(objects)) return o;
9
-
10
- // don't slice args for v8 optimizations
11
- var len = arguments.length - 1;
12
- for (var i = 0; i < len; i++) {
13
- var obj = arguments[i + 1];
6
+ function mixinDeep(target, objects) {
7
+ var len = arguments.length, i = 0;
8
+ while (++i < len) {
9
+ var obj = arguments[i];
14
10
  if (isObject(obj)) {
15
- forOwn(obj, copy, o);
11
+ forIn(obj, copy, target);
16
12
  }
17
13
  }
18
- return o;
14
+ return target;
19
15
  }
20
16
 
21
17
  /**
22
- * copy properties from the source object to the
18
+ * Copy properties from the source object to the
23
19
  * target object.
24
20
  *
25
- * @param {*} `value`
21
+ * @param {*} `val`
26
22
  * @param {String} `key`
27
23
  */
28
24
 
29
- function copy(value, key) {
25
+ function copy(val, key) {
30
26
  var obj = this[key];
31
- if (isObject(value) && isObject(obj)) {
32
- mixinDeep(obj, value);
27
+ if (isObject(val) && isObject(obj)) {
28
+ mixinDeep(obj, val);
33
29
  } else {
34
- this[key] = value;
30
+ this[key] = val;
35
31
  }
36
32
  }
37
33
 
34
+ /**
35
+ * Returns true if `val` is an object or function.
36
+ *
37
+ * @param {any} val
38
+ * @return {Boolean}
39
+ */
40
+
41
+ function isObject(val) {
42
+ return isExtendable(val) && !Array.isArray(val);
43
+ }
44
+
38
45
  /**
39
46
  * Expose `mixinDeep`
40
47
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mixin-deep",
3
3
  "description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.",
4
- "version": "1.1.1",
4
+ "version": "1.3.0",
5
5
  "homepage": "https://github.com/jonschlinkert/mixin-deep",
6
6
  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7
7
  "repository": "jonschlinkert/mixin-deep",
@@ -20,12 +20,13 @@
20
20
  "test": "mocha"
21
21
  },
22
22
  "dependencies": {
23
- "for-own": "^0.1.3",
24
- "is-plain-object": "^2.0.0"
23
+ "for-in": "^1.0.2",
24
+ "is-extendable": "^1.0.1"
25
25
  },
26
26
  "devDependencies": {
27
- "mocha": "^2.2.4",
28
- "should": "^6.0.1"
27
+ "gulp-format-md": "^1.0.0",
28
+ "mocha": "^3.5.3",
29
+ "should": "^13.1.3"
29
30
  },
30
31
  "keywords": [
31
32
  "deep",
@@ -39,5 +40,26 @@
39
40
  "properties",
40
41
  "util",
41
42
  "values"
42
- ]
43
+ ],
44
+ "verb": {
45
+ "toc": false,
46
+ "layout": "default",
47
+ "tasks": [
48
+ "readme"
49
+ ],
50
+ "plugins": [
51
+ "gulp-format-md"
52
+ ],
53
+ "related": {
54
+ "list": [
55
+ "defaults-deep",
56
+ "extend-shallow",
57
+ "merge-deep",
58
+ "mixin-object"
59
+ ]
60
+ },
61
+ "lint": {
62
+ "reflinks": true
63
+ }
64
+ }
43
65
  }