summaryrefslogtreecommitdiff
path: root/node_modules/xtend
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/xtend')
-rw-r--r--node_modules/xtend/.npmignore1
-rw-r--r--node_modules/xtend/LICENCE19
-rw-r--r--node_modules/xtend/Makefile4
-rw-r--r--node_modules/xtend/README.md27
-rw-r--r--node_modules/xtend/has-keys.js7
-rw-r--r--node_modules/xtend/index.js25
-rw-r--r--node_modules/xtend/mutable.js25
-rw-r--r--node_modules/xtend/package.json62
-rw-r--r--node_modules/xtend/test.js63
9 files changed, 233 insertions, 0 deletions
diff --git a/node_modules/xtend/.npmignore b/node_modules/xtend/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/node_modules/xtend/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/xtend/LICENCE b/node_modules/xtend/LICENCE
new file mode 100644
index 0000000..a23e08a
--- /dev/null
+++ b/node_modules/xtend/LICENCE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Raynos.
+
+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. \ No newline at end of file
diff --git a/node_modules/xtend/Makefile b/node_modules/xtend/Makefile
new file mode 100644
index 0000000..d583fcf
--- /dev/null
+++ b/node_modules/xtend/Makefile
@@ -0,0 +1,4 @@
+browser:
+ node ./support/compile
+
+.PHONY: browser \ No newline at end of file
diff --git a/node_modules/xtend/README.md b/node_modules/xtend/README.md
new file mode 100644
index 0000000..389adae
--- /dev/null
+++ b/node_modules/xtend/README.md
@@ -0,0 +1,27 @@
+# xtend
+
+[![browser support][3]][4]
+
+Extend like a boss
+
+xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes presedence.
+
+## Examples
+
+```js
+var extend = require("xtend")
+
+var combination = extend({
+ a: "a"
+}, {
+ b: "b"
+})
+// { a: "a", b: "b" }
+```
+
+
+## MIT Licenced
+
+
+ [3]: http://ci.testling.com/Raynos/xtend.png
+ [4]: http://ci.testling.com/Raynos/xtend
diff --git a/node_modules/xtend/has-keys.js b/node_modules/xtend/has-keys.js
new file mode 100644
index 0000000..62391e7
--- /dev/null
+++ b/node_modules/xtend/has-keys.js
@@ -0,0 +1,7 @@
+module.exports = hasKeys
+
+function hasKeys(source) {
+ return source !== null &&
+ (typeof source === "object" ||
+ typeof source === "function")
+}
diff --git a/node_modules/xtend/index.js b/node_modules/xtend/index.js
new file mode 100644
index 0000000..20937d1
--- /dev/null
+++ b/node_modules/xtend/index.js
@@ -0,0 +1,25 @@
+var Keys = require("object-keys")
+var hasKeys = require("./has-keys")
+
+module.exports = extend
+
+function extend() {
+ var target = {}
+
+ for (var i = 0; i < arguments.length; i++) {
+ var source = arguments[i]
+
+ if (!hasKeys(source)) {
+ continue
+ }
+
+ var keys = Keys(source)
+
+ for (var j = 0; j < keys.length; j++) {
+ var name = keys[j]
+ target[name] = source[name]
+ }
+ }
+
+ return target
+}
diff --git a/node_modules/xtend/mutable.js b/node_modules/xtend/mutable.js
new file mode 100644
index 0000000..17454ae
--- /dev/null
+++ b/node_modules/xtend/mutable.js
@@ -0,0 +1,25 @@
+var Keys = require("object-keys")
+var hasKeys = require("./has-keys")
+
+module.exports = extend
+
+function extend(target) {
+ var sources = [].slice.call(arguments, 1)
+
+ for (var i = 0; i < sources.length; i++) {
+ var source = sources[i]
+
+ if (!hasKeys(source)) {
+ continue
+ }
+
+ var keys = Keys(source)
+
+ for (var j = 0; j < keys.length; j++) {
+ var name = keys[j]
+ target[name] = source[name]
+ }
+ }
+
+ return target
+}
diff --git a/node_modules/xtend/package.json b/node_modules/xtend/package.json
new file mode 100644
index 0000000..d93be22
--- /dev/null
+++ b/node_modules/xtend/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "xtend",
+ "version": "2.1.2",
+ "description": "extend like a boss",
+ "keywords": [
+ "extend",
+ "merge",
+ "options",
+ "opts",
+ "object",
+ "array"
+ ],
+ "author": "Raynos <raynos2@gmail.com>",
+ "repository": "git://github.com/Raynos/xtend.git",
+ "main": "index",
+ "scripts": {
+ "test": "node test"
+ },
+ "dependencies": {
+ "object-keys": "~0.4.0"
+ },
+ "devDependencies": {
+ "tape": "~1.1.0"
+ },
+ "homepage": "https://github.com/Raynos/xtend",
+ "contributors": [
+ {
+ "name": "Jake Verbaten"
+ },
+ {
+ "name": "Matt Esch"
+ }
+ ],
+ "bugs": {
+ "url": "https://github.com/Raynos/xtend/issues",
+ "email": "raynos2@gmail.com"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://github.com/raynos/xtend/raw/master/LICENSE"
+ }
+ ],
+ "testling": {
+ "files": "test.js",
+ "browsers": [
+ "ie/7..latest",
+ "firefox/16..latest",
+ "firefox/nightly",
+ "chrome/22..latest",
+ "chrome/canary",
+ "opera/12..latest",
+ "opera/next",
+ "safari/5.1..latest",
+ "ipad/6.0..latest",
+ "iphone/6.0..latest"
+ ]
+ },
+ "engines": {
+ "node": ">=0.4"
+ }
+}
diff --git a/node_modules/xtend/test.js b/node_modules/xtend/test.js
new file mode 100644
index 0000000..3369d79
--- /dev/null
+++ b/node_modules/xtend/test.js
@@ -0,0 +1,63 @@
+var test = require("tape")
+var extend = require("./")
+var mutableExtend = require("./mutable")
+
+test("merge", function(assert) {
+ var a = { a: "foo" }
+ var b = { b: "bar" }
+
+ assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
+ assert.end()
+})
+
+test("replace", function(assert) {
+ var a = { a: "foo" }
+ var b = { a: "bar" }
+
+ assert.deepEqual(extend(a, b), { a: "bar" })
+ assert.end()
+})
+
+test("undefined", function(assert) {
+ var a = { a: undefined }
+ var b = { b: "foo" }
+
+ assert.deepEqual(extend(a, b), { a: undefined, b: "foo" })
+ assert.deepEqual(extend(b, a), { a: undefined, b: "foo" })
+ assert.end()
+})
+
+test("handle 0", function(assert) {
+ var a = { a: "default" }
+ var b = { a: 0 }
+
+ assert.deepEqual(extend(a, b), { a: 0 })
+ assert.deepEqual(extend(b, a), { a: "default" })
+ assert.end()
+})
+
+test("is immutable", function (assert) {
+ var record = {}
+
+ extend(record, { foo: "bar" })
+ assert.equal(record.foo, undefined)
+ assert.end()
+})
+
+test("null as argument", function (assert) {
+ var a = { foo: "bar" }
+ var b = null
+ var c = void 0
+
+ assert.deepEqual(extend(b, a, c), { foo: "bar" })
+ assert.end()
+})
+
+test("mutable", function (assert) {
+ var a = { foo: "bar" }
+
+ mutableExtend(a, { bar: "baz" })
+
+ assert.equal(a.bar, "baz")
+ assert.end()
+})