pax_global_header00006660000000000000000000000064121675777700014535gustar00rootroot0000000000000052 comment=80f8533cde3039ff68efead269c41fb5f1a0e59b utils-merge-1.0.0/000077500000000000000000000000001216757777000137705ustar00rootroot00000000000000utils-merge-1.0.0/.gitignore000066400000000000000000000000731216757777000157600ustar00rootroot00000000000000# Mac OS X .DS_Store # Node.js node_modules npm-debug.log utils-merge-1.0.0/.npmignore000066400000000000000000000001751216757777000157720ustar00rootroot00000000000000README.md Makefile doc/ examples/ test/ # Mac OS X .DS_Store # Node.js .npmignore node_modules/ npm-debug.log # Git .git* utils-merge-1.0.0/.travis.yml000066400000000000000000000001061216757777000160760ustar00rootroot00000000000000language: "node_js" node_js: - "0.4" - "0.6" - "0.8" - "0.10" utils-merge-1.0.0/LICENSE000066400000000000000000000020631216757777000147760ustar00rootroot00000000000000(The MIT License) Copyright (c) 2013 Jared Hanson 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. utils-merge-1.0.0/Makefile000066400000000000000000000016661216757777000154410ustar00rootroot00000000000000SOURCES = *.js TESTS = test/*.test.js # ============================================================================== # Node Tests # ============================================================================== MOCHA = ./node_modules/.bin/mocha test: test-node test-node: node_modules $(MOCHA) \ --reporter spec \ --require test/bootstrap/node $(TESTS) node_modules: npm install # ============================================================================== # Code Quality # ============================================================================== JSHINT = jshint hint: lint lint: $(JSHINT) $(SOURCES) # ============================================================================== # Clean # ============================================================================== clean: rm -rf build clobber: clean rm -rf node_modules rm -rf components rm -rf test/www/js/lib .PHONY: test test-node hint lint clean clobber utils-merge-1.0.0/README.md000066400000000000000000000011721216757777000152500ustar00rootroot00000000000000# utils-merge Merges the properties from a source object into a destination object. ## Install $ npm install utils-merge ## Usage ```javascript var a = { foo: 'bar' } , b = { bar: 'baz' }; merge(a, b); // => { foo: 'bar', bar: 'baz' } ``` ## Tests $ npm install $ npm test [![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge) ## Credits - [Jared Hanson](http://github.com/jaredhanson) ## License [The MIT License](http://opensource.org/licenses/MIT) Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> utils-merge-1.0.0/index.js000066400000000000000000000005751216757777000154440ustar00rootroot00000000000000/** * Merge object b with object a. * * var a = { foo: 'bar' } * , b = { bar: 'baz' }; * * merge(a, b); * // => { foo: 'bar', bar: 'baz' } * * @param {Object} a * @param {Object} b * @return {Object} * @api public */ exports = module.exports = function(a, b){ if (a && b) { for (var key in b) { a[key] = b[key]; } } return a; }; utils-merge-1.0.0/package.json000066400000000000000000000014621216757777000162610ustar00rootroot00000000000000{ "name": "utils-merge", "version": "1.0.0", "description": "merge() utility function", "keywords": [ "util" ], "repository": { "type": "git", "url": "git://github.com/jaredhanson/utils-merge.git" }, "bugs": { "url": "http://github.com/jaredhanson/utils-merge/issues" }, "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, "licenses": [ { "type": "MIT", "url": "http://www.opensource.org/licenses/MIT" } ], "main": "./index", "dependencies": { }, "devDependencies": { "mocha": "1.x.x", "chai": "1.x.x" }, "scripts": { "test": "node_modules/.bin/mocha --reporter spec --require test/bootstrap/node test/*.test.js" }, "engines": { "node": ">= 0.4.0" } } utils-merge-1.0.0/test/000077500000000000000000000000001216757777000147475ustar00rootroot00000000000000utils-merge-1.0.0/test/bootstrap/000077500000000000000000000000001216757777000167645ustar00rootroot00000000000000utils-merge-1.0.0/test/bootstrap/node.js000066400000000000000000000000721216757777000202460ustar00rootroot00000000000000var chai = require('chai'); global.expect = chai.expect; utils-merge-1.0.0/test/index.test.js000066400000000000000000000027001216757777000173710ustar00rootroot00000000000000var merge = require('../index'); describe('utils-merge', function() { it('should export function', function() { expect(merge).to.be.a('function'); }); }); describe('merge', function() { describe('an object', function() { var a = { foo: 'bar' } , b = { bar: 'baz' }; var o = merge(a, b); it('should merge properties into first object', function() { expect(Object.keys(a)).to.have.length(2); expect(a.foo).to.be.equal('bar'); expect(a.bar).to.be.equal('baz'); }); it('should return first argument', function() { expect(o).to.be.equal(a); }); }); describe('an object with duplicate key', function() { var a = { foo: 'bar', qux: 'corge' } , b = { foo: 'baz' }; var o = merge(a, b); it('should merge properties into first object', function() { expect(Object.keys(a)).to.have.length(2); expect(a.foo).to.be.equal('baz'); expect(a.qux).to.be.equal('corge'); }); it('should return first argument', function() { expect(o).to.be.equal(a); }); }); describe('without a source object', function() { var a = { foo: 'bar' }; var o = merge(a); it('should leave first object unmodified', function() { expect(Object.keys(a)).to.have.length(1); expect(a.foo).to.be.equal('bar'); }); it('should return first argument', function() { expect(o).to.be.equal(a); }); }); });