[Pkg-javascript-commits] [node-extend] 01/08: New upstream version 3.0.0

Paolo Greppi paolog-guest at moszumanska.debian.org
Wed Dec 14 08:05:48 UTC 2016


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

paolog-guest pushed a commit to branch master
in repository node-extend.

commit 74696fee4aa733b35279ca5e9796637bbd1b7729
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date:   Wed Dec 14 07:43:50 2016 +0000

    New upstream version 3.0.0
---
 .eslintrc      | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 .gitignore     |   1 +
 .jscs.json     |  40 +++++++++++-
 .travis.yml    |  30 ++++++++-
 CHANGELOG.md   |  69 +++++++++++++++++++++
 component.json |   2 +-
 index.js       |  59 ++++++++++--------
 package.json   |  16 +++--
 test/index.js  |  92 +++++++++++++++------------
 9 files changed, 425 insertions(+), 76 deletions(-)

diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..d49f173
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,192 @@
+{
+	"env": {
+		"browser": false,
+		"node": true,
+		"amd": false,
+		"mocha": false,
+		"jasmine": false
+	},
+
+	"rules": {
+		"accessor-pairs": [2, { getWithoutSet: false, setWithoutGet: true }],
+		"array-bracket-spacing": [2, "never", {
+			"singleValue": false,
+			"objectsInArrays": false,
+			"arraysInArrays": false
+		}],
+		"block-scoped-var": [0],
+		"brace-style": [2, "1tbs", { "allowSingleLine": true }],
+		"camelcase": [2],
+		"comma-dangle": [2, "never"],
+		"comma-spacing": [2],
+		"comma-style": [2, "last"],
+		"complexity": [2, 15],
+		"computed-property-spacing": [2, "never"],
+		"consistent-return": [2],
+		"consistent-this": [0, "that"],
+		"constructor-super": [2],
+		"curly": [2, "all"],
+		"default-case": [2],
+		"dot-notation": [2, { "allowKeywords": true }],
+		"eol-last": [2],
+		"eqeqeq": [2],
+		"func-names": [0],
+		"func-style": [2, "expression"],
+		"generator-star-spacing": [2, { "before": false, "after": true }],
+		"global-strict": [0, "never"],
+		"guard-for-in": [0],
+		"handle-callback-err": [0],
+		"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
+		"linebreak-style": [2, "unix"],
+		"lines-around-comment": [2, {
+			"beforeBlockComment": false,
+			"afterBlockComment": false,
+			"beforeLineComment": false,
+			"beforeLineComment": false,
+			"allowBlockStart": true,
+			"allowBlockEnd": true
+		}],
+		"quotes": [2, "single", "avoid-escape"],
+		"max-depth": [1, 4],
+		"max-len": [0, 80, 4],
+		"max-nested-callbacks": [2, 2],
+		"max-params": [2, 2],
+		"max-statements": [2, 21],
+		"new-parens": [2],
+		"new-cap": [2],
+		"newline-after-var": [0],
+		"no-alert": [2],
+		"no-array-constructor": [2],
+		"no-bitwise": [0],
+		"no-caller": [2],
+		"no-catch-shadow": [2],
+		"no-cond-assign": [2],
+		"no-console": [2],
+		"no-constant-condition": [2],
+		"no-continue": [2],
+		"no-control-regex": [2],
+		"no-debugger": [2],
+		"no-delete-var": [2],
+		"no-div-regex": [0],
+		"no-dupe-args": [2],
+		"no-dupe-keys": [2],
+		"no-duplicate-case": [2],
+		"no-else-return": [0],
+		"no-empty": [2],
+		"no-empty-character-class": [2],
+		"no-empty-label": [2],
+		"no-eq-null": [0],
+		"no-eval": [2],
+		"no-ex-assign": [2],
+		"no-extend-native": [2],
+		"no-extra-bind": [2],
+		"no-extra-boolean-cast": [2],
+		"no-extra-parens": [0],
+		"no-extra-semi": [2],
+		"no-fallthrough": [2],
+		"no-floating-decimal": [2],
+		"no-func-assign": [2],
+		"no-implied-eval": [2],
+		"no-inline-comments": [0],
+		"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-lonely-if": [2],
+		"no-loop-func": [2],
+		"no-mixed-requires": [0, false],
+		"no-mixed-spaces-and-tabs": [2, false],
+		"no-multi-spaces": [2],
+		"no-multi-str": [2],
+		"no-multiple-empty-lines": [2, {"max": 1}],
+		"no-native-reassign": [2],
+		"no-negated-in-lhs": [2],
+		"no-nested-ternary": [0],
+		"no-new": [2],
+		"no-new-func": [2],
+		"no-new-object": [2],
+		"no-new-require": [0],
+		"no-new-wrappers": [2],
+		"no-obj-calls": [2],
+		"no-octal": [2],
+		"no-octal-escape": [2],
+		"no-param-reassign": [2],
+		"no-path-concat": [0],
+		"no-plusplus": [0],
+		"no-process-env": [0],
+		"no-process-exit": [2],
+		"no-proto": [2],
+		"no-redeclare": [2],
+		"no-regex-spaces": [2],
+		"no-reserved-keys": [2],
+		"no-restricted-modules": [0],
+		"no-return-assign": [2, "always"],
+		"no-script-url": [2],
+		"no-self-compare": [0],
+		"no-sequences": [2],
+		"no-shadow": [2],
+		"no-shadow-restricted-names": [2],
+		"no-space-before-semi": [2],
+		"no-spaced-func": [2],
+		"no-sparse-arrays": [2],
+		"no-sync": [0],
+		"no-ternary": [0],
+		"no-this-before-super": [2],
+		"no-throw-literal": [2],
+		"no-trailing-spaces": [2, { "skipBlankLines": false }],
+		"no-undef": [2],
+		"no-undef-init": [2],
+		"no-undefined": [0],
+		"no-underscore-dangle": [2],
+		"no-unexpected-multiline": [2],
+		"no-unneeded-ternary": [2],
+		"no-unreachable": [2],
+		"no-unused-expressions": [2],
+		"no-unused-vars": [2, { "vars": "all", "args": "after-used" }],
+		"no-use-before-define": [2],
+		"no-void": [0],
+		"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
+		"no-with": [2],
+		"no-wrap-func": [2],
+		"object-curly-spacing": [2, "always"],
+		"object-shorthand": [2, "never"],
+		"one-var": [0],
+		"operator-assignment": [0, "always"],
+		"operator-linebreak": [2, "none"],
+		"padded-blocks": [0],
+		"prefer-const": [0],
+		"quote-props": [0],
+		"radix": [0],
+		"semi": [2],
+		"semi-spacing": [2, { "before": false, "after": true }],
+		"sort-vars": [0],
+		"space-after-keywords": [2, "always"],
+		"space-before-function-paren": [2, { "anonymous": "always", "named": "never" }],
+		"space-before-blocks": [0, "always"],
+		"space-in-brackets": [0, "never", {
+			"singleValue": true,
+			"arraysInArrays": false,
+			"arraysInObjects": false,
+			"objectsInArrays": true,
+			"objectsInObjects": true,
+			"propertyName": false
+		}],
+		"space-in-parens": [2, "never"],
+		"space-infix-ops": [2],
+		"space-return-throw-case": [2],
+		"space-unary-ops": [2, { "words": true, "nonwords": false }],
+		"spaced-comment": [2, "always"],
+		"spaced-line-comment": [0, "always"],
+		"strict": [2, "global"],
+		"use-isnan": [2],
+		"valid-jsdoc": [0],
+		"valid-typeof": [2],
+		"vars-on-top": [0],
+		"wrap-iife": [2],
+		"wrap-regex": [2],
+		"yoda": [2, "never", { "exceptRange": true, "onlyEquality": false }]
+	}
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b512c09
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
\ No newline at end of file
diff --git a/.jscs.json b/.jscs.json
index 8bca4f1..7e84b28 100644
--- a/.jscs.json
+++ b/.jscs.json
@@ -1,6 +1,12 @@
 {
 	"additionalRules": [],
 
+	"requireSemicolons": true,
+
+	"disallowMultipleSpaces": true,
+
+	"disallowIdentifierNames": [],
+
 	"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
 
 	"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
@@ -13,6 +19,8 @@
 	"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
 	"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
 
+	"requireSpaceBetweenArguments": true,
+
 	"disallowSpacesInsideParentheses": true,
 
 	"disallowSpacesInsideArrayBrackets": true,
@@ -61,6 +69,36 @@
 	"validateQuoteMarks": {
 		"escape": true,
 		"mark": "'"
-	}
+	},
+
+	"disallowOperatorBeforeLineBreak": [],
+
+	"requireSpaceBeforeKeywords": [
+		"do",
+		"for",
+		"if",
+		"else",
+		"switch",
+		"case",
+		"try",
+		"catch",
+		"finally",
+		"while",
+		"with",
+		"return"
+	],
+
+	"validateAlignedFunctionParameters": {
+		"lineBreakAfterOpeningBraces": true,
+		"lineBreakBeforeClosingBraces": true
+	},
+
+	"requirePaddingNewLinesBeforeExport": true,
+
+	"validateNewlineAfterArrayElements": {
+		"maximum": 6
+	},
+
+	"requirePaddingNewLinesAfterUseStrict": true
 }
 
diff --git a/.travis.yml b/.travis.yml
index 912080a..ebef644 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,19 @@
 language: node_js
 node_js:
+  - "iojs-v2.3"
+  - "iojs-v2.2"
+  - "iojs-v2.1"
+  - "iojs-v2.0"
+  - "iojs-v1.8"
+  - "iojs-v1.7"
+  - "iojs-v1.6"
+  - "iojs-v1.5"
+  - "iojs-v1.4"
+  - "iojs-v1.3"
+  - "iojs-v1.2"
+  - "iojs-v1.1"
+  - "iojs-v1.0"
+  - "0.12"
   - "0.11"
   - "0.10"
   - "0.9"
@@ -7,12 +21,24 @@ node_js:
   - "0.6"
   - "0.4"
 before_install:
-  - '[ "${TRAVIS_NODE_VERSION}" == "0.6" ] || npm install -g npm@~1.4.6'
+  - '[ "${TRAVIS_NODE_VERSION}" = "0.6" ] || npm install -g npm at 1.4.28 && npm install -g npm'
+sudo: false
 matrix:
   fast_finish: true
   allow_failures:
+    - node_js: "iojs-v2.2"
+    - node_js: "iojs-v2.1"
+    - node_js: "iojs-v2.0"
+    - node_js: "iojs-v1.7"
+    - node_js: "iojs-v1.6"
+    - node_js: "iojs-v1.5"
+    - node_js: "iojs-v1.4"
+    - node_js: "iojs-v1.3"
+    - node_js: "iojs-v1.2"
+    - node_js: "iojs-v1.1"
+    - node_js: "iojs-v1.0"
     - node_js: "0.11"
     - node_js: "0.9"
+    - node_js: "0.8"
     - node_js: "0.6"
     - node_js: "0.4"
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..ee0cfd6
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,69 @@
+3.0.0 / 2015-07-01
+==================
+  * [Possible breaking change] Use global "strict" directive (#32)
+  * [Tests] `int` is an ES3 reserved word
+  * [Tests] Test up to `io.js` `v2.3`
+  * [Tests] Add `npm run eslint`
+  * [Dev Deps] Update `covert`, `jscs`
+
+2.0.1 / 2015-04-25
+==================
+  * Use an inline `isArray` check, for ES3 browsers. (#27)
+  * Some old browsers fail when an identifier is `toString`
+  * Test latest `node` and `io.js` versions on `travis-ci`; speed up builds
+  * Add license info to package.json (#25)
+  * Update `tape`, `jscs`
+  * Adding a CHANGELOG
+
+2.0.0 / 2014-10-01
+==================
+  * Increase code coverage to 100%; run code coverage as part of tests
+  * Add `npm run lint`; Run linter as part of tests
+  * Remove nodeType and setInterval checks in isPlainObject
+  * Updating `tape`, `jscs`, `covert`
+  * General style and README cleanup
+
+1.3.0 / 2014-06-20
+==================
+  * Add component.json for browser support (#18)
+  * Use SVG for badges in README (#16)
+  * Updating `tape`, `covert`
+  * Updating travis-ci to work with multiple node versions
+  * Fix `deep === false` bug (returning target as {}) (#14)
+  * Fixing constructor checks in isPlainObject
+  * Adding additional test coverage
+  * Adding `npm run coverage`
+  * Add LICENSE (#13)
+  * Adding a warning about `false`, per #11
+  * General style and whitespace cleanup
+
+1.2.1 / 2013-09-14
+==================
+  * Fixing hasOwnProperty bugs that would only have shown up in specific browsers. Fixes #8
+  * Updating `tape`
+
+1.2.0 / 2013-09-02
+==================
+  * Updating the README: add badges
+  * Adding a missing variable reference.
+  * Using `tape` instead of `buster` for tests; add more tests (#7)
+  * Adding node 0.10 to Travis CI (#6)
+  * Enabling "npm test" and cleaning up package.json (#5)
+  * Add Travis CI.
+
+1.1.3 / 2012-12-06
+==================
+  * Added unit tests.
+  * Ensure extend function is named. (Looks nicer in a stack trace.)
+  * README cleanup.
+
+1.1.1 / 2012-11-07
+==================
+  * README cleanup.
+  * Added installation instructions.
+  * Added a missing semicolon
+
+1.0.0 / 2012-04-08
+==================
+  * Initial commit
+
diff --git a/component.json b/component.json
index adcc2d5..1500a2f 100644
--- a/component.json
+++ b/component.json
@@ -1,7 +1,7 @@
 {
 	"name": "extend",
 	"author": "Stefan Thomas <justmoon at members.fsf.org> (http://www.justmoon.net)",
-	"version": "2.0.0",
+	"version": "3.0.0",
 	"description": "Port of jQuery.extend for node.js and the browser.",
 	"scripts": [
 		"index.js"
diff --git a/index.js b/index.js
index 59e7ee6..f5ec75d 100644
--- a/index.js
+++ b/index.js
@@ -1,30 +1,37 @@
+'use strict';
+
 var hasOwn = Object.prototype.hasOwnProperty;
-var toString = Object.prototype.toString;
-var undefined;
+var toStr = Object.prototype.toString;
+
+var isArray = function isArray(arr) {
+	if (typeof Array.isArray === 'function') {
+		return Array.isArray(arr);
+	}
+
+	return toStr.call(arr) === '[object Array]';
+};
 
 var isPlainObject = function isPlainObject(obj) {
-	'use strict';
-	if (!obj || toString.call(obj) !== '[object Object]') {
+	if (!obj || toStr.call(obj) !== '[object Object]') {
 		return false;
 	}
 
-	var has_own_constructor = hasOwn.call(obj, 'constructor');
-	var has_is_property_of_method = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
+	var hasOwnConstructor = hasOwn.call(obj, 'constructor');
+	var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
 	// Not own constructor property must be Object
-	if (obj.constructor && !has_own_constructor && !has_is_property_of_method) {
+	if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
 		return false;
 	}
 
 	// Own properties are enumerated firstly, so to speed up,
 	// if last one is own, then all properties are own.
 	var key;
-	for (key in obj) {}
+	for (key in obj) {/**/}
 
-	return key === undefined || hasOwn.call(obj, key);
+	return typeof key === 'undefined' || hasOwn.call(obj, key);
 };
 
 module.exports = function extend() {
-	'use strict';
 	var options, name, src, copy, copyIsArray, clone,
 		target = arguments[0],
 		i = 1,
@@ -51,25 +58,23 @@ module.exports = function extend() {
 				copy = options[name];
 
 				// Prevent never-ending loop
-				if (target === copy) {
-					continue;
-				}
-
-				// Recurse if we're merging plain objects or arrays
-				if (deep && copy && (isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
-					if (copyIsArray) {
-						copyIsArray = false;
-						clone = src && Array.isArray(src) ? src : [];
-					} else {
-						clone = src && isPlainObject(src) ? src : {};
-					}
+				if (target !== copy) {
+					// Recurse if we're merging plain objects or arrays
+					if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
+						if (copyIsArray) {
+							copyIsArray = false;
+							clone = src && isArray(src) ? src : [];
+						} else {
+							clone = src && isPlainObject(src) ? src : {};
+						}
 
-					// Never move original objects, clone them
-					target[name] = extend(deep, clone, copy);
+						// Never move original objects, clone them
+						target[name] = extend(deep, clone, copy);
 
-				// Don't bring in undefined values
-				} else if (copy !== undefined) {
-					target[name] = copy;
+					// Don't bring in undefined values
+					} else if (typeof copy !== 'undefined') {
+						target[name] = copy;
+					}
 				}
 			}
 		}
diff --git a/package.json b/package.json
index 351c2a0..ab1dfe4 100644
--- a/package.json
+++ b/package.json
@@ -1,14 +1,16 @@
 {
 	"name": "extend",
 	"author": "Stefan Thomas <justmoon at members.fsf.org> (http://www.justmoon.net)",
-	"version": "2.0.0",
+	"version": "3.0.0",
 	"description": "Port of jQuery.extend for node.js and the browser",
 	"main": "index",
 	"scripts": {
 		"test": "npm run lint && node test/index.js && npm run coverage-quiet",
 		"coverage": "covert test/index.js",
 		"coverage-quiet": "covert test/index.js --quiet",
-		"lint": "jscs *.js */*.js"
+		"lint": "npm run jscs && npm run eslint",
+		"jscs": "jscs *.js */*.js",
+		"eslint": "eslint *.js */*.js"
 	},
 	"contributors": [
 		{
@@ -27,9 +29,11 @@
 	},
 	"dependencies": {},
 	"devDependencies": {
-		"tape": "~3.0.0",
-		"covert": "~1.0.0",
-		"jscs": "~1.6.2"
-	}
+		"tape": "^4.0.0",
+		"covert": "^1.1.0",
+		"jscs": "^1.13.1",
+		"eslint": "^0.24.0"
+	},
+	"license": "MIT"
 }
 
diff --git a/test/index.js b/test/index.js
index d646349..cb4117f 100644
--- a/test/index.js
+++ b/test/index.js
@@ -1,8 +1,10 @@
+'use strict';
+
 var extend = require('../index');
 var test = require('tape');
 
 var str = 'me a test';
-var int = 10;
+var integer = 10;
 var arr = [1, 'what', new Date(81, 8, 4)];
 var date = new Date(81, 4, 13);
 
@@ -10,7 +12,7 @@ var Foo = function () {};
 
 var obj = {
 	str: str,
-	int: int,
+	integer: integer,
 	arr: arr,
 	date: date,
 	constructor: 'fake',
@@ -21,13 +23,13 @@ var obj = {
 var deep = {
 	ori: obj,
 	layer: {
-		int: 10,
+		integer: 10,
 		str: 'str',
 		date: new Date(84, 5, 12),
 		arr: [101, 'dude', new Date(82, 10, 4)],
 		deep: {
 			str: obj.str,
-			int: int,
+			integer: integer,
 			arr: obj.arr,
 			date: new Date(81, 7, 4)
 		}
@@ -106,7 +108,7 @@ test('merge string with obj', function (t) {
 	t.equal(ori, 'what u gonna say', 'original string is unchanged');
 	var testObj = {
 		str: 'me a test',
-		int: 10,
+		integer: 10,
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
@@ -168,7 +170,7 @@ test('merge number with object', function (t) {
 	var target = extend(20, obj);
 	var testObj = {
 		str: 'me a test',
-		int: 10,
+		integer: 10,
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
@@ -239,7 +241,7 @@ test('merge array with object', function (t) {
 	var target = extend(ori, obj);
 	var testObject = {
 		str: 'me a test',
-		int: 10,
+		integer: 10,
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
@@ -250,13 +252,13 @@ test('merge array with object', function (t) {
 	t.deepEqual(obj, testObject, 'obj is unchanged');
 	t.equal(ori.length, 6, 'array has proper length');
 	t.equal(ori.str, obj.str, 'array has obj.str property');
-	t.equal(ori.int, obj.int, 'array has obj.int property');
+	t.equal(ori.integer, obj.integer, 'array has obj.integer property');
 	t.deepEqual(ori.arr, obj.arr, 'array has obj.arr property');
 	t.equal(ori.date, obj.date, 'array has obj.date property');
 
 	t.equal(target.length, 6, 'target has proper length');
 	t.equal(target.str, obj.str, 'target has obj.str property');
-	t.equal(target.int, obj.int, 'target has obj.int property');
+	t.equal(target.integer, obj.integer, 'target has obj.integer property');
 	t.deepEqual(target.arr, obj.arr, 'target has obj.arr property');
 	t.equal(target.date, obj.date, 'target has obj.date property');
 	t.end();
@@ -319,7 +321,7 @@ test('merge date with object', function (t) {
 	var testDate = new Date(81, 8, 4);
 	var testObject = {
 		str: 'me a test',
-		int: 10,
+		integer: 10,
 		arr: [1, 'what', testDate],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
@@ -337,7 +339,7 @@ test('merge object with string', function (t) {
 	var testDate = new Date(81, 7, 26);
 	var ori = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: testDate
 	};
@@ -353,7 +355,7 @@ test('merge object with string', function (t) {
 		7: 's',
 		8: 't',
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: testDate
 	};
@@ -367,13 +369,13 @@ test('merge object with string', function (t) {
 test('merge object with number', function (t) {
 	var ori = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26)
 	};
 	var testObject = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26)
 	};
@@ -386,7 +388,7 @@ test('merge object with number', function (t) {
 test('merge object with array', function (t) {
 	var ori = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26)
 	};
@@ -396,7 +398,7 @@ test('merge object with array', function (t) {
 		1: 'what',
 		2: new Date(81, 8, 4),
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26)
 	};
@@ -410,14 +412,14 @@ test('merge object with array', function (t) {
 test('merge object with date', function (t) {
 	var ori = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26)
 	};
 	var target = extend(ori, date);
 	var testObject = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26)
 	};
@@ -431,7 +433,7 @@ test('merge object with date', function (t) {
 test('merge object with object', function (t) {
 	var ori = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26),
 		foo: 'bar'
@@ -439,7 +441,7 @@ test('merge object with object', function (t) {
 	var target = extend(ori, obj);
 	var expectedObj = {
 		str: 'me a test',
-		int: 10,
+		integer: 10,
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
@@ -448,10 +450,9 @@ test('merge object with object', function (t) {
 	};
 	var expectedTarget = {
 		str: 'me a test',
-		int: 10,
+		integer: 10,
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
-		foo: 'bar',
 		constructor: 'fake',
 		isPrototypeOf: 'not a function',
 		foo: new Foo()
@@ -466,12 +467,12 @@ test('merge object with object', function (t) {
 test('deep clone', function (t) {
 	var ori = {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26),
 		layer: {
 			deep: {
-				int: 42
+				integer: 42
 			}
 		}
 	};
@@ -479,12 +480,12 @@ test('deep clone', function (t) {
 
 	t.deepEqual(ori, {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26),
 		ori: {
 			str: 'me a test',
-			int: 10,
+			integer: 10,
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
@@ -492,13 +493,13 @@ test('deep clone', function (t) {
 			foo: new Foo()
 		},
 		layer: {
-			int: 10,
+			integer: 10,
 			str: 'str',
 			date: new Date(84, 5, 12),
 			arr: [101, 'dude', new Date(82, 10, 4)],
 			deep: {
 				str: 'me a test',
-				int: 10,
+				integer: 10,
 				arr: [1, 'what', new Date(81, 8, 4)],
 				date: new Date(81, 7, 4)
 			}
@@ -507,7 +508,7 @@ test('deep clone', function (t) {
 	t.deepEqual(deep, {
 		ori: {
 			str: 'me a test',
-			int: 10,
+			integer: 10,
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
@@ -515,13 +516,13 @@ test('deep clone', function (t) {
 			foo: new Foo()
 		},
 		layer: {
-			int: 10,
+			integer: 10,
 			str: 'str',
 			date: new Date(84, 5, 12),
 			arr: [101, 'dude', new Date(82, 10, 4)],
 			deep: {
 				str: 'me a test',
-				int: 10,
+				integer: 10,
 				arr: [1, 'what', new Date(81, 8, 4)],
 				date: new Date(81, 7, 4)
 			}
@@ -529,12 +530,12 @@ test('deep clone', function (t) {
 	}, 'deep is unchanged');
 	t.deepEqual(target, {
 		str: 'no shit',
-		int: 76,
+		integer: 76,
 		arr: [1, 2, 3, 4],
 		date: new Date(81, 7, 26),
 		ori: {
 			str: 'me a test',
-			int: 10,
+			integer: 10,
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
@@ -542,13 +543,13 @@ test('deep clone', function (t) {
 			foo: new Foo()
 		},
 		layer: {
-			int: 10,
+			integer: 10,
 			str: 'str',
 			date: new Date(84, 5, 12),
 			arr: [101, 'dude', new Date(82, 10, 4)],
 			deep: {
 				str: 'me a test',
-				int: 10,
+				integer: 10,
 				arr: [1, 'what', new Date(81, 8, 4)],
 				date: new Date(81, 7, 4)
 			}
@@ -559,7 +560,7 @@ test('deep clone', function (t) {
 	t.deepEqual(deep, {
 		ori: {
 			str: 'me a test',
-			int: 10,
+			integer: 10,
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
@@ -567,19 +568,19 @@ test('deep clone', function (t) {
 			foo: new Foo()
 		},
 		layer: {
-			int: 10,
+			integer: 10,
 			str: 'str',
 			date: new Date(84, 5, 12),
 			arr: [101, 'dude', new Date(82, 10, 4)],
 			deep: {
 				str: 'me a test',
-				int: 10,
+				integer: 10,
 				arr: [1, 'what', new Date(81, 8, 4)],
 				date: new Date(81, 7, 4)
 			}
 		}
 	}, 'deep is unchanged after setting target property');
-	//----- NEVER USE EXTEND WITH THE ABOVE SITUATION ------------------------------
+	// ----- NEVER USE EXTEND WITH THE ABOVE SITUATION ------------------------------
 	t.end();
 });
 
@@ -621,3 +622,16 @@ test('pass in null; should create a valid object', function (t) {
 	t.end();
 });
 
+test('works without Array.isArray', function (t) {
+	var savedIsArray = Array.isArray;
+	Array.isArray = false; // don't delete, to preserve enumerability
+	var target = [];
+	var source = [1, [2], { 3: true }];
+	t.deepEqual(
+		extend(true, target, source),
+		[1, [2], { 3: true }],
+		'It works without Array.isArray'
+	);
+	Array.isArray = savedIsArray;
+	t.end();
+});

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



More information about the Pkg-javascript-commits mailing list