[Pkg-javascript-commits] [node-mixin-deep] 01/06: Import Upstream version 1.1.3

Sruthi Chandran srud-guest at moszumanska.debian.org
Fri Oct 28 07:40:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

srud-guest pushed a commit to branch master
in repository node-mixin-deep.

commit a41a3ec6160840bc680c73044a23cedcc5c4d5fc
Author: Sruthi <srud at disroot.org>
Date:   Fri Oct 28 12:32:07 2016 +0530

    Import Upstream version 1.1.3
---
 .gitattributes |  10 ++++++
 .gitignore     |  53 ++++++++++++++++++++++++++++++
 .jshintrc      |  18 ++++++++++
 .travis.yml    |   8 +++++
 .verb.md       |  36 ++++++++++++++++++++
 LICENSE        |  21 ++++++++++++
 README.md      |  62 +++++++++++++++++++++++++++++++++++
 bower.json     |  35 ++++++++++++++++++++
 index.js       |  49 ++++++++++++++++++++++++++++
 package.json   |  53 ++++++++++++++++++++++++++++++
 test.js        | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 11 files changed, 446 insertions(+)

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..4a3f1d3
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,10 @@
+# Enforce Unix newlines
+* text eol=lf
+
+# binaries
+*.ai binary
+*.psd binary
+*.jpg binary
+*.gif binary
+*.png binary
+*.jpeg binary
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..92139bd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,53 @@
+# Numerous always-ignore extensions
+*.DS_Store
+*.csv
+*.dat
+*.diff
+*.err
+*.gz
+*.log
+*.orig
+*.out
+*.pid
+*.rar
+*.rej
+*.seed
+*.swo
+*.swp
+*.vi
+*.yo-rc.json
+*.zip
+*~
+.ruby-version
+lib-cov
+npm-debug.log
+
+# Always-ignore dirs
+/bower_components/
+/node_modules/
+/temp/
+/tmp/
+/vendor/
+_gh_pages
+
+# OS or Editor folders
+*.esproj
+*.komodoproject
+.komodotools
+*.sublime-*
+._*
+.cache
+.DS_Store
+.idea
+.project
+.settings
+.tmproj
+nbproject
+Thumbs.db
+
+# grunt-html-validation
+validation-status.json
+validation-report.json
+
+# misc
+TODO.md
\ No newline at end of file
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..6e5a84a
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,18 @@
+{
+  "asi": false,
+  "boss": true,
+  "curly": true,
+  "eqeqeq": true,
+  "eqnull": true,
+  "esnext": true,
+  "immed": true,
+  "latedef": false,
+  "laxcomma": false,
+  "mocha": true,
+  "newcap": true,
+  "noarg": true,
+  "node": true,
+  "sub": true,
+  "undef": true,
+  "unused": true
+}
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..f9cffe6
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+sudo: false
+language: node_js
+node_js:
+  - "0.10"
+  - "0.12"
+  - "iojs"
+git:
+  depth: 10
diff --git a/.verb.md b/.verb.md
new file mode 100644
index 0000000..da4e4b0
--- /dev/null
+++ b/.verb.md
@@ -0,0 +1,36 @@
+# {%= name %} {%= badge("fury") %}
+
+> {%= description %}
+
+## Install
+{%= include("install-npm", {save: true}) %}
+{%= include("install-bower", {save: true}) %}
+
+## Usage
+
+```js
+var mixinDeep = require('{%= name %}');
+
+mixinDeep({a: {aa: 'aa'}}, {a: {bb: 'bb'}}, {a: {cc: 'cc'}});
+//=> { a: { aa: 'aa', bb: 'bb', cc: 'cc' } }
+```
+
+## Related projects
+{%= related(['merge-deep', 'mixin-deep', 'extend-shallow', 'assign-deep', 'defaults-deep', 'omit-deep'], {remove: name}) %}
+
+## Running tests
+{%= include("tests") %}
+
+## Contributing
+{%= include("contributing") %}
+
+## Author
+{%= include("author") %}
+
+## License
+{%= copyright() %}
+{%= license() %}
+
+***
+
+{%= include("footer") %}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..fa30c4c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2015, Jon Schlinkert.
+
+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:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+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.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5105749
--- /dev/null
+++ b/README.md
@@ -0,0 +1,62 @@
+# mixin-deep [![NPM version](https://badge.fury.io/js/mixin-deep.svg)](http://badge.fury.io/js/mixin-deep)
+
+> Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
+
+## Install
+
+Install with [npm](https://www.npmjs.com/)
+
+```sh
+$ npm i mixin-deep --save
+```
+
+Install with [bower](http://bower.io/)
+
+```sh
+$ bower install mixin-deep --save
+```
+
+## Usage
+
+```js
+var mixinDeep = require('mixin-deep');
+
+mixinDeep({a: {aa: 'aa'}}, {a: {bb: 'bb'}}, {a: {cc: 'cc'}});
+//=> { a: { aa: 'aa', bb: 'bb', cc: 'cc' } }
+```
+
+## Related projects
+
+* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. | [homepage](https://github.com/jonschlinkert/assign-deep)
+* [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)
+* [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)
+* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep)
+* [omit-deep](https://www.npmjs.com/package/omit-deep): Recursively omit the specified key or keys from an object. | [homepage](https://github.com/jonschlinkert/omit-deep)
+
+## Running tests
+
+Install dev dependencies:
+
+```sh
+$ npm i -d && npm test
+```
+
+## Contributing
+
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/mixin-deep/issues/new).
+
+## Author
+
+**Jon Schlinkert**
+
++ [github/jonschlinkert](https://github.com/jonschlinkert)
++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+## License
+
+Copyright © 2015 Jon Schlinkert
+Released under the MIT license.
+
+***
+
+_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 28, 2015._
diff --git a/bower.json b/bower.json
new file mode 100644
index 0000000..c91640a
--- /dev/null
+++ b/bower.json
@@ -0,0 +1,35 @@
+{
+  "name": "mixin-deep",
+  "description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.",
+  "repository": "jonschlinkert/mixin-deep",
+  "license": "MIT",
+  "homepage": "https://github.com/jonschlinkert/mixin-deep",
+  "authors": [
+    "Jon Schlinkert (https://github.com/jonschlinkert)"
+  ],
+  "main": [
+    "index.js"
+  ],
+  "dependencies": {
+    "for-in": "^0.1.4",
+    "is-extendable": "^0.1.1",
+    "lazy-cache": "^0.2.3"
+  },
+  "devDependencies": {
+    "mocha": "*",
+    "should": "*"
+  },
+  "keywords": [
+    "deep",
+    "extend",
+    "key",
+    "keys",
+    "merge",
+    "mixin",
+    "object",
+    "prop",
+    "properties",
+    "util",
+    "values"
+  ]
+}
\ No newline at end of file
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..60f7049
--- /dev/null
+++ b/index.js
@@ -0,0 +1,49 @@
+'use strict';
+
+var isExtendable = require('is-extendable');
+var forIn = require('for-in');
+
+function mixinDeep(target, objects) {
+  var len = arguments.length, i = 0;
+  while (++i < len) {
+    var obj = arguments[i];
+    if (isObject(obj)) {
+      forIn(obj, copy, target);
+    }
+  }
+  return target;
+}
+
+/**
+ * Copy properties from the source object to the
+ * target object.
+ *
+ * @param  {*} `val`
+ * @param  {String} `key`
+ */
+
+function copy(val, key) {
+  var obj = this[key];
+  if (isObject(val) && isObject(obj)) {
+    mixinDeep(obj, val);
+  } else {
+    this[key] = val;
+  }
+}
+
+/**
+ * Returns true if `val` is an object or function.
+ *
+ * @param  {any} val
+ * @return {Boolean}
+ */
+
+function isObject(val) {
+  return isExtendable(val) && !Array.isArray(val);
+}
+
+/**
+ * Expose `mixinDeep`
+ */
+
+module.exports = mixinDeep;
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..797571b
--- /dev/null
+++ b/package.json
@@ -0,0 +1,53 @@
+{
+  "name": "mixin-deep",
+  "description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.",
+  "version": "1.1.3",
+  "homepage": "https://github.com/jonschlinkert/mixin-deep",
+  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+  "repository": "jonschlinkert/mixin-deep",
+  "bugs": {
+    "url": "https://github.com/jonschlinkert/mixin-deep/issues"
+  },
+  "license": "MIT",
+  "files": [
+    "index.js"
+  ],
+  "main": "index.js",
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "mocha"
+  },
+  "dependencies": {
+    "for-in": "^0.1.4",
+    "is-extendable": "^0.1.1"
+  },
+  "devDependencies": {
+    "mocha": "*",
+    "should": "*"
+  },
+  "keywords": [
+    "deep",
+    "extend",
+    "key",
+    "keys",
+    "merge",
+    "mixin",
+    "object",
+    "prop",
+    "properties",
+    "util",
+    "values"
+  ],
+  "verbiage": {
+    "related": {
+      "list": [
+        "mixin-object",
+        "merge-deep",
+        "extend-shallow",
+        "defaults-deep"
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..7e9d21d
--- /dev/null
+++ b/test.js
@@ -0,0 +1,101 @@
+/*!
+ * mixin-deep <https://github.com/jonschlinkert/mixin-deep>
+ *
+ * Copyright (c) 2014-2015 Jon Schlinkert.
+ * Licensed under the MIT License
+ */
+
+'use strict';
+
+/* deps: mocha */
+require('should');
+var mixinDeep = require('./');
+
+describe('.mixinDeep()', function () {
+  it('should deeply mix the properties of object into the first object.', function () {
+    var a = mixinDeep({a: {aa: 'aa'} }, {a: {bb: 'bb'} }, {a: {cc: 'cc'} }); a.should.eql({a: {aa: 'aa', bb: 'bb', cc: 'cc'} });
+    var b = mixinDeep({a: {aa: 'aa', dd: {ee: 'ff'} } }, {a: {bb: 'bb', dd: {gg: 'hh'} } }, {a: {cc: 'cc', dd: {ii: 'jj'} } });
+    b.should.eql({a: {aa: 'aa', dd: {ee: 'ff', gg: 'hh', ii: 'jj'}, bb: 'bb', cc: 'cc'} });
+  });
+
+  it('should merge object properties without affecting any object', function () {
+    var obj1 = {a: 0, b: 1};
+    var obj2 = {c: 2, d: 3};
+    var obj3 = {a: 4, d: 5};
+
+    var actual = {a: 4, b: 1, c: 2, d: 5 };
+
+    mixinDeep({}, obj1, obj2, obj3).should.eql(actual);
+    actual.should.not.eql(obj1);
+    actual.should.not.eql(obj2);
+    actual.should.not.eql(obj3);
+  });
+
+  it('should do a deep merge', function () {
+    var obj1 = {a: {b: 1, c: 1, d: {e: 1, f: 1}}};
+    var obj2 = {a: {b: 2, d : {f : 'f'} }};
+
+    mixinDeep(obj1, obj2).should.eql({a: {b: 2, c: 1, d: {e: 1, f: 'f'} }});
+  });
+
+  it('should merge additional objects into the first:', function () {
+    var obj1 = {a: {b: 1, c: 1, d: {e: 1, f: 1}}};
+    var obj2 = {a: {b: 2, d : {f : 'f'} }};
+
+    mixinDeep(obj1, obj2);
+    obj1.should.eql({a: {b: 2, c: 1, d: {e: 1, f: 'f'} }});
+  });
+
+  it('should clone objects during merge', function () {
+    var obj1 = {a: {b :1}};
+    var obj2 = {a: {c :2}};
+
+    var actual = mixinDeep({}, obj1, obj2);
+    actual.should.eql({a:{b:1, c:2}});
+    actual.a.should.eql(obj1.a);
+    actual.a.should.not.eql(obj2.a);
+  });
+
+  it('should deep clone arrays during merge', function () {
+    var obj1 = {a: [1, 2, [3, 4]]};
+    var obj2 = {b : [5, 6]};
+
+    var actual = mixinDeep(obj1, obj2);
+    actual.a.should.eql([1, 2, [3, 4]]);
+    actual.a[2].should.eql([3, 4]);
+    actual.b.should.eql(obj2.b);
+  });
+
+  it('should copy source properties', function() {
+    mixinDeep({ test: true }).test.should.be.true;
+  });
+
+  it('should not clone arrays', function() {
+    mixinDeep([1, 2, 3]).should.eql([1, 2, 3]);
+    mixinDeep([1, 2, 3], {}).should.eql([1, 2, 3]);
+  });
+
+  it('should work with sparse objects:', function() {
+    var actual = mixinDeep({}, undefined, {a: 'b'}, undefined, {c: 'd'});
+    actual.should.eql({a: 'b', c: 'd'});
+  });
+
+  it('should clone RegExps', function() {
+    var fixture = /test/g;
+    var actual = mixinDeep(fixture);
+    actual.should.eql(fixture);
+  });
+
+  it('should clone Dates', function() {
+    var fixture = new Date();
+    var actual = mixinDeep(fixture);
+    actual.should.eql(fixture);
+  });
+
+  it('should not clone objects created with custom constructor', function() {
+    function TestType() { }
+    var fixture = new TestType();
+    var actual = mixinDeep(fixture);
+    actual.should.eql(fixture);
+  });
+});
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mixin-deep.git



More information about the Pkg-javascript-commits mailing list