Skip to content

Commit

Permalink
Add bower.json for browser install.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Ashworth committed Feb 1, 2014
1 parent 3f4e488 commit 7eb740f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
6 changes: 6 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ With [npm](http://npmjs.org) do:
npm install deepmerge
```

For the browser, you can install with [bower](http://bower.io/):

```
bower install deepmerge
```

test
====

Expand Down
24 changes: 24 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "deepmerge",
"main": "index.js",
"version": "0.2.5",
"homepage": "https://github.com/nrf110/deepmerge",
"authors": [
"Nicholas Fisher <[email protected]>"
],
"description": "Merge the enumerable attributes of two objects.",
"keywords": [
"merge",
"extend",
"assign"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"app/bower_components",
"test",
"tests"
]
}
18 changes: 15 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
module.exports = function merge (target, src) {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory)
} else if (typeof exports === 'object') {
module.exports = factory()
} else {
root.deepmerge = factory()
}
}(this, function () {

return function deepmerge(target, src) {
var array = Array.isArray(src)
var dst = array && [] || {}

Expand All @@ -9,7 +19,7 @@ module.exports = function merge (target, src) {
if (typeof target[i] === 'undefined') {
dst[i] = e
} else if (typeof e === 'object') {
dst[i] = merge(target[i], e)
dst[i] = deepmerge(target[i], e)
} else {
if (target.indexOf(e) === -1) {
dst.push(e)
Expand All @@ -30,11 +40,13 @@ module.exports = function merge (target, src) {
if (!target[key]) {
dst[key] = src[key]
} else {
dst[key] = merge(target[key], src[key])
dst[key] = deepmerge(target[key], src[key])
}
}
})
}

return dst
}

}))
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"node": ">=0.4.0"
},
"scripts": {
"test" : "tap test/*.js"
"test": "tap test/*.js"
},
"dependencies": {},
"devDependencies": {
"tap" : "~0.2.4"
"tap": "~0.4.8"
}
}

0 comments on commit 7eb740f

Please sign in to comment.