pax_global_header00006660000000000000000000000064135024725230014515gustar00rootroot0000000000000052 comment=9166566d5e5a60047e43a80a3c1a7c68f829a047 mixin-deep-2.0.1/000077500000000000000000000000001350247252300135545ustar00rootroot00000000000000mixin-deep-2.0.1/.editorconfig000066400000000000000000000004411350247252300162300ustar00rootroot00000000000000# http://editorconfig.org/ root = true [*] charset = utf-8 end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true [{**/{actual,fixtures,expected,templates}/**,*.md}] trim_trailing_whitespace = false insert_final_newline = false mixin-deep-2.0.1/.eslintrc.json000066400000000000000000000073251350247252300163570ustar00rootroot00000000000000{ "extends": [ "eslint:recommended" ], "env": { "browser": false, "es6": true, "node": true, "mocha": true }, "parserOptions":{ "ecmaVersion": 9, "sourceType": "module", "ecmaFeatures": { "modules": true, "experimentalObjectRestSpread": true } }, "globals": { "document": false, "navigator": false, "window": false }, "rules": { "accessor-pairs": 2, "arrow-spacing": [2, { "before": true, "after": true }], "block-spacing": [2, "always"], "brace-style": [2, "1tbs", { "allowSingleLine": true }], "comma-dangle": [2, "never"], "comma-spacing": [2, { "before": false, "after": true }], "comma-style": [2, "last"], "constructor-super": 2, "curly": [2, "multi-line"], "dot-location": [2, "property"], "eol-last": 2, "eqeqeq": [2, "allow-null"], "generator-star-spacing": [2, { "before": true, "after": true }], "handle-callback-err": [2, "^(err|error)$" ], "indent": [2, 2, { "SwitchCase": 1 }], "key-spacing": [2, { "beforeColon": false, "afterColon": true }], "keyword-spacing": [2, { "before": true, "after": true }], "new-cap": [2, { "newIsCap": true, "capIsNew": false }], "new-parens": 2, "no-array-constructor": 2, "no-caller": 2, "no-class-assign": 2, "no-cond-assign": 2, "no-const-assign": 2, "no-control-regex": 2, "no-debugger": 2, "no-delete-var": 2, "no-dupe-args": 2, "no-dupe-class-members": 2, "no-dupe-keys": 2, "no-duplicate-case": 2, "no-empty-character-class": 2, "no-eval": 2, "no-ex-assign": 2, "no-extend-native": 2, "no-extra-bind": 2, "no-extra-boolean-cast": 2, "no-extra-parens": [2, "functions"], "no-fallthrough": 2, "no-floating-decimal": 2, "no-func-assign": 2, "no-implied-eval": 2, "no-inner-declarations": [2, "functions"], "no-invalid-regexp": 2, "no-irregular-whitespace": 2, "no-iterator": 2, "no-label-var": 2, "no-labels": 2, "no-lone-blocks": 2, "no-mixed-spaces-and-tabs": 2, "no-multi-spaces": 2, "no-multi-str": 2, "no-multiple-empty-lines": [2, { "max": 1 }], "no-native-reassign": 0, "no-negated-in-lhs": 2, "no-new": 2, "no-new-func": 2, "no-new-object": 2, "no-new-require": 2, "no-new-wrappers": 2, "no-obj-calls": 2, "no-octal": 2, "no-octal-escape": 2, "no-proto": 0, "no-redeclare": 2, "no-regex-spaces": 2, "no-return-assign": 2, "no-self-compare": 2, "no-sequences": 2, "no-shadow-restricted-names": 2, "no-spaced-func": 2, "no-sparse-arrays": 2, "no-this-before-super": 2, "no-throw-literal": 2, "no-trailing-spaces": 0, "no-undef": 2, "no-undef-init": 2, "no-unexpected-multiline": 2, "no-unneeded-ternary": [2, { "defaultAssignment": false }], "no-unreachable": 2, "no-unused-vars": [2, { "vars": "all", "args": "none" }], "no-useless-call": 0, "no-with": 2, "one-var": [0, { "initialized": "never" }], "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], "padded-blocks": [0, "never"], "quotes": [2, "single", "avoid-escape"], "radix": 2, "semi": [2, "always"], "semi-spacing": [2, { "before": false, "after": true }], "space-before-blocks": [2, "always"], "space-before-function-paren": [2, "never"], "space-in-parens": [2, "never"], "space-infix-ops": 2, "space-unary-ops": [2, { "words": true, "nonwords": false }], "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], "use-isnan": 2, "valid-typeof": 2, "wrap-iife": [2, "any"], "yoda": [2, "never"] } } mixin-deep-2.0.1/.gitattributes000066400000000000000000000001771350247252300164540ustar00rootroot00000000000000# Enforce Unix newlines * text eol=lf # binaries *.ai binary *.psd binary *.jpg binary *.gif binary *.png binary *.jpeg binarymixin-deep-2.0.1/.gitignore000066400000000000000000000004561350247252300155510ustar00rootroot00000000000000# always ignore files *.DS_Store .idea .vscode *.sublime-* # test related, or directories generated by tests test/actual actual coverage .nyc* # npm node_modules npm-debug.log # yarn yarn.lock yarn-error.log # misc _gh_pages _draft _drafts bower_components vendor temp tmp TODO.md package-lock.jsonmixin-deep-2.0.1/.npmrc000066400000000000000000000000231350247252300146670ustar00rootroot00000000000000package-lock=false mixin-deep-2.0.1/.travis.yml000066400000000000000000000001571350247252300156700ustar00rootroot00000000000000sudo: false os: - linux - osx language: node_js node_js: - node - '10' - '9' - '8' - '7' - '6' mixin-deep-2.0.1/.verb.md000066400000000000000000000006171350247252300151160ustar00rootroot00000000000000## Heads up! [Please update][update] to version 2.0.1 or later, a critical bug was fixed in that version. ## Usage ```js const mixin = require('{%= name %}'); const res = mixin({ a: { foo: true } }, { a: { bar: true } }, { a: { baz: true } }); console.log(res); //=> { a: { foo: true, bar: true, baz: true } } ``` [update]: https://gist.github.com/jonschlinkert/9a62534c4f8bc76aee6058caa3f05fd6mixin-deep-2.0.1/LICENSE000066400000000000000000000021031350247252300145550ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014-present, 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. mixin-deep-2.0.1/README.md000066400000000000000000000103051350247252300150320ustar00rootroot00000000000000# mixin-deep [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![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) > Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. No dependencies. Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install --save mixin-deep ``` ## Heads up! [Please update](https://gist.github.com/jonschlinkert/9a62534c4f8bc76aee6058caa3f05fd6) to version 2.0.1 or later, a critical bug was fixed in that version. ## Usage ```js const mixin = require('mixin-deep'); const res = mixin({ a: { foo: true } }, { a: { bar: true } }, { a: { baz: true } }); console.log(res); //=> { a: { foo: true, bar: true, baz: true } } ``` ## About
Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Running Tests 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: ```sh $ npm install && npm test ```
Building docs _(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.)_ To generate the readme, run the following command: ```sh $ npm install -g verbose/verb#dev verb-generate-readme && verb ```
### Related projects You might also be interested in these projects: * [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.") * [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.") * [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.") * [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.") ### Contributors | **Commits** | **Contributor** | | --- | --- | | 28 | [jonschlinkert](https://github.com/jonschlinkert) | | 2 | [doowb](https://github.com/doowb) | ### Author **Jon Schlinkert** * [GitHub Profile](https://github.com/jonschlinkert) * [Twitter Profile](https://twitter.com/jonschlinkert) * [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) ### License Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). Released under the [MIT License](LICENSE). *** _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on June 19, 2019._mixin-deep-2.0.1/bower.json000066400000000000000000000016251350247252300155710ustar00rootroot00000000000000{ "name": "mixin-deep", "description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. No dependencies.", "version": "1.3.0", "homepage": "https://github.com/jonschlinkert/mixin-deep", "authors": [ "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" ], "devDependencies": { "gulp-format-md": "^1.0.0", "mocha": "^5.2.0" }, "keywords": [ "deep", "extend", "key", "keys", "merge", "mixin", "object", "prop", "properties", "util", "values" ], "ignore": [ "actual", "bower_components", "fixtures", "node_modules", "temp", "test", "test.js", "tmp" ] }mixin-deep-2.0.1/index.js000066400000000000000000000013471350247252300152260ustar00rootroot00000000000000'use strict'; const isObject = val => { return typeof val === 'function' || (typeof val === 'object' && val !== null && !Array.isArray(val)); }; const isValidKey = key => { return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; }; const mixinDeep = (target, ...rest) => { for (let obj of rest) { if (isObject(obj)) { for (let key in obj) { if (isValidKey(key)) { mixin(target, obj[key], key); } } } } return target; }; function mixin(target, val, key) { let obj = target[key]; if (isObject(val) && isObject(obj)) { mixinDeep(obj, val); } else { target[key] = val; } } /** * Expose mixinDeep * @type {Function} */ module.exports = mixinDeep; mixin-deep-2.0.1/package.json000066400000000000000000000022321350247252300160410ustar00rootroot00000000000000{ "name": "mixin-deep", "description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. No dependencies.", "version": "2.0.1", "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": ">=6" }, "scripts": { "test": "mocha" }, "devDependencies": { "gulp-format-md": "^2.0.0", "mocha": "^6.1.4" }, "keywords": [ "assign", "deep", "extend", "key", "keys", "merge", "mixin", "object", "prop", "properties", "util", "values" ], "verb": { "toc": false, "layout": "default", "tasks": [ "readme" ], "plugins": [ "gulp-format-md" ], "related": { "list": [ "defaults-deep", "extend-shallow", "merge-deep", "mixin-object" ] }, "lint": { "reflinks": true } } } mixin-deep-2.0.1/test.js000066400000000000000000000077661350247252300151110ustar00rootroot00000000000000/*! * mixin-deep * * Copyright (c) 2014-present Jon Schlinkert. * Licensed under the MIT License */ 'use strict'; require('mocha'); const assert = require('assert'); const mixinDeep = require('./'); describe('.mixinDeep()', function() { it('should deeply mix the properties of object into the first object.', function() { const a = mixinDeep({ a: { aa: 'aa' } }, { a: { bb: 'bb' } }, { a: { cc: 'cc' } }); assert.deepEqual(a, { a: { aa: 'aa', bb: 'bb', cc: 'cc' } }); const b = mixinDeep( { a: { aa: 'aa', dd: { ee: 'ff' } } }, { a: { bb: 'bb', dd: { gg: 'hh' } } }, { a: { cc: 'cc', dd: { ii: 'jj' } } } ); assert.deepEqual(b, { a: { aa: 'aa', dd: { ee: 'ff', gg: 'hh', ii: 'jj' }, bb: 'bb', cc: 'cc' } }); }); it('should copy properties onto the first object', function() { const obj1 = { a: 0, b: 1 }; const obj2 = { c: 2, d: 3 }; const obj3 = { a: 4, d: 5 }; const actual = { a: 4, b: 1, c: 2, d: 5 }; assert.deepEqual(mixinDeep({}, obj1, obj2, obj3), actual); assert.notDeepEqual(actual, obj1); assert.notDeepEqual(actual, obj2); assert.notDeepEqual(actual, obj3); }); it('should mixin nested object properties', function() { const obj1 = { a: { b: 1, c: 1, d: { e: 1, f: 1 } } }; const obj2 = { a: { b: 2, d: { f: 'f' } } }; assert.deepEqual(mixinDeep(obj1, obj2), { a: { b: 2, c: 1, d: { e: 1, f: 'f' } } }); }); it('should use the last value defined', function() { const obj1 = { a: 'b' }; const obj2 = { a: 'c' }; assert.deepEqual(mixinDeep(obj1, obj2), { a: 'c' }); }); it('should use the last value defined on nested object', function() { const obj1 = { a: 'b', c: { d: 'e' } }; const obj2 = { a: 'c', c: { d: 'f' } }; assert.deepEqual(mixinDeep(obj1, obj2), { a: 'c', c: { d: 'f' } }); }); it('should shallow mixin when an empty object is passed', function() { const obj1 = { a: 'b', c: { d: 'e' } }; const obj2 = { a: 'c', c: { d: 'f' } }; const res = mixinDeep({}, obj1, obj2); assert.deepEqual(res, { a: 'c', c: { d: 'f' } }); }); it('should mixin additional objects into the first:', function() { const obj1 = { a: { b: 1, c: 1, d: { e: 1, f: 1 } } }; const obj2 = { a: { b: 2, d: { f: 'f' } } }; mixinDeep(obj1, obj2); assert.deepEqual(obj1, { a: { b: 2, c: 1, d: { e: 1, f: 'f' } } }); }); it('should mixin objects during mixin', function() { const obj1 = { a: { b: 1 } }; const obj2 = { a: { c: 2 } }; const actual = mixinDeep({}, obj1, obj2); assert.deepEqual(actual, { a: { b: 1, c: 2 } }); assert.deepEqual(actual.a, obj1.a); assert.notDeepEqual(actual.a, obj2.a); }); it('should deep mixin arrays during mixin', function() { const obj1 = { a: [1, 2, [3, 4]] }; const obj2 = { b: [5, 6] }; const actual = mixinDeep(obj1, obj2); assert.deepEqual(actual.a, [1, 2, [3, 4]]); assert.deepEqual(actual.a[2], [3, 4]); assert.deepEqual(actual.b, obj2.b); }); it('should not modify source properties', function() { assert.equal(mixinDeep({ test: true }).test, true); }); it('should not mixin arrays', function() { assert.deepEqual(mixinDeep([1, 2, 3]), [1, 2, 3]); assert.deepEqual(mixinDeep([1, 2, 3], {}), [1, 2, 3]); }); it('should work with sparse objects:', function() { const actual = mixinDeep({}, undefined, { a: 'b' }, undefined, { c: 'd' }); assert.deepEqual(actual, { a: 'b', c: 'd' }); }); it('should mixin RegExps', function() { const fixture = /test/g; const actual = mixinDeep(fixture); assert.deepEqual(actual, fixture); }); it('should mixin Dates', function() { const fixture = new Date(); const actual = mixinDeep(fixture); assert.deepEqual(actual, fixture); }); it('should not mixin objects created with custom constructor', function() { function TestType() {} const fixture = new TestType(); const actual = mixinDeep(fixture); assert.deepEqual(actual, fixture); }); });