[Pkg-javascript-commits] [node-extend] 01/04: Imported Upstream version 2.0.0

Leo Iannacone l3on-guest at moszumanska.debian.org
Sat Oct 11 23:29:40 UTC 2014


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

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

commit 7677b9eaa11b8ce1451da8ae9021b43a3f54055f
Author: Leo Iannacone <l3on at ubuntu.com>
Date:   Sun Oct 12 01:22:20 2014 +0200

    Imported Upstream version 2.0.0
---
 .jscs.json     |  66 ++++++++++++++++++++++++
 README.md      |  38 +++++++-------
 component.json |   7 +--
 index.js       |  15 +++---
 package.json   |  17 ++++---
 test/index.js  | 155 ++++++++++++++++++++++++++++++++-------------------------
 6 files changed, 194 insertions(+), 104 deletions(-)

diff --git a/.jscs.json b/.jscs.json
new file mode 100644
index 0000000..8bca4f1
--- /dev/null
+++ b/.jscs.json
@@ -0,0 +1,66 @@
+{
+	"additionalRules": [],
+
+	"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
+
+	"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
+
+	"disallowSpaceAfterKeywords": [],
+
+	"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
+	"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
+	"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
+	"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
+	"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
+
+	"disallowSpacesInsideParentheses": true,
+
+	"disallowSpacesInsideArrayBrackets": true,
+
+	"disallowQuotedKeysInObjects": "allButReserved",
+
+	"disallowSpaceAfterObjectKeys": true,
+
+	"requireCommaBeforeLineBreak": true,
+
+	"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
+	"requireSpaceAfterPrefixUnaryOperators": [],
+
+	"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
+	"requireSpaceBeforePostfixUnaryOperators": [],
+
+	"disallowSpaceBeforeBinaryOperators": [],
+	"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
+
+	"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
+	"disallowSpaceAfterBinaryOperators": [],
+
+	"disallowImplicitTypeConversion": ["binary", "string"],
+
+	"disallowKeywords": ["with", "eval"],
+
+	"requireKeywordsOnNewLine": [],
+	"disallowKeywordsOnNewLine": ["else"],
+
+	"requireLineFeedAtFileEnd": true,
+
+	"disallowTrailingWhitespace": true,
+
+	"disallowTrailingComma": true,
+
+	"excludeFiles": ["node_modules/**", "vendor/**"],
+
+	"disallowMultipleLineStrings": true,
+
+	"requireDotNotation": true,
+
+	"requireParenthesesAroundIIFE": true,
+
+	"validateLineBreaks": "LF",
+
+	"validateQuoteMarks": {
+		"escape": true,
+		"mark": "'"
+	}
+}
+
diff --git a/README.md b/README.md
index 715f666..632fb0f 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,14 @@
-[![Build Status][1]][2] [![dependency status][9]][10] [![dev dependency status][11]][12]
+[![Build Status][travis-svg]][travis-url]
+[![dependency status][deps-svg]][deps-url]
+[![dev dependency status][dev-deps-svg]][dev-deps-url]
 
-# extend() for Node.js <sup>[![Version Badge][8]][3]</sup>
+# extend() for Node.js <sup>[![Version Badge][npm-version-png]][npm-url]</sup>
 
 `node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true.
 
 ## Installation
 
-This package is available on [npm][3] as: `extend`
+This package is available on [npm][npm-url] as: `extend`
 
 ``` sh
 npm install extend
@@ -37,24 +39,24 @@ More objects to merge into the first.
 
 ## License
 
-`node-extend` is licensed under the [MIT License][4].
+`node-extend` is licensed under the [MIT License][mit-license-url].
 
 ## Acknowledgements
 
 All credit to the jQuery authors for perfecting this amazing utility.
 
-Ported to Node.js by [Stefan Thomas][5] with contributions by [Jonathan Buchanan][6] and [Jordan Harband][7].
-
-[1]: https://travis-ci.org/justmoon/node-extend.svg
-[2]: https://travis-ci.org/justmoon/node-extend
-[3]: https://npmjs.org/package/extend
-[4]: http://opensource.org/licenses/MIT
-[5]: https://github.com/justmoon
-[6]: https://github.com/insin
-[7]: https://github.com/ljharb
-[8]: http://vb.teelaun.ch/justmoon/node-extend.svg
-[9]: https://david-dm.org/justmoon/node-extend.svg
-[10]: https://david-dm.org/justmoon/node-extend
-[11]: https://david-dm.org/justmoon/node-extend/dev-status.svg
-[12]: https://david-dm.org/justmoon/node-extend#info=devDependencies
+Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb].
+
+[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg
+[travis-url]: https://travis-ci.org/justmoon/node-extend
+[npm-url]: https://npmjs.org/package/extend
+[mit-license-url]: http://opensource.org/licenses/MIT
+[github-justmoon]: https://github.com/justmoon
+[github-insin]: https://github.com/insin
+[github-ljharb]: https://github.com/ljharb
+[npm-version-png]: http://vb.teelaun.ch/justmoon/node-extend.svg
+[deps-svg]: https://david-dm.org/justmoon/node-extend.svg
+[deps-url]: https://david-dm.org/justmoon/node-extend
+[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg
+[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies
 
diff --git a/component.json b/component.json
index 378c7f5..adcc2d5 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": "1.3.0",
+	"version": "2.0.0",
 	"description": "Port of jQuery.extend for node.js and the browser.",
 	"scripts": [
 		"index.js"
@@ -24,8 +24,9 @@
 	"dependencies": {
 	},
 	"devDependencies": {
-		"tape" : "~2.12.3",
-		"covert": "~0.4.0"
+		"tape" : "~3.0.0",
+		"covert": "~0.4.0",
+		"jscs": "~1.6.2"
 	}
 }
 
diff --git a/index.js b/index.js
index 06f3c12..59e7ee6 100644
--- a/index.js
+++ b/index.js
@@ -3,8 +3,8 @@ var toString = Object.prototype.toString;
 var undefined;
 
 var isPlainObject = function isPlainObject(obj) {
-	"use strict";
-	if (!obj || toString.call(obj) !== '[object Object]' || obj.nodeType || obj.setInterval) {
+	'use strict';
+	if (!obj || toString.call(obj) !== '[object Object]') {
 		return false;
 	}
 
@@ -24,7 +24,7 @@ var isPlainObject = function isPlainObject(obj) {
 };
 
 module.exports = function extend() {
-	"use strict";
+	'use strict';
 	var options, name, src, copy, copyIsArray, clone,
 		target = arguments[0],
 		i = 1,
@@ -32,18 +32,19 @@ module.exports = function extend() {
 		deep = false;
 
 	// Handle a deep copy situation
-	if (typeof target === "boolean") {
+	if (typeof target === 'boolean') {
 		deep = target;
 		target = arguments[1] || {};
 		// skip the boolean and the target
 		i = 2;
-	} else if (typeof target !== "object" && typeof target !== "function" || target == undefined) {
-			target = {};
+	} else if ((typeof target !== 'object' && typeof target !== 'function') || target == null) {
+		target = {};
 	}
 
 	for (; i < length; ++i) {
+		options = arguments[i];
 		// Only deal with non-null/undefined values
-		if ((options = arguments[i]) != null) {
+		if (options != null) {
 			// Extend the base object
 			for (name in options) {
 				src = target[name];
diff --git a/package.json b/package.json
index ddcee05..351c2a0 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,14 @@
 {
 	"name": "extend",
 	"author": "Stefan Thomas <justmoon at members.fsf.org> (http://www.justmoon.net)",
-	"version": "1.3.0",
+	"version": "2.0.0",
 	"description": "Port of jQuery.extend for node.js and the browser",
 	"main": "index",
 	"scripts": {
-		"test": "node test/index.js",
+		"test": "npm run lint && node test/index.js && npm run coverage-quiet",
 		"coverage": "covert test/index.js",
-		"coverage-quiet": "covert test/index.js --quiet"
+		"coverage-quiet": "covert test/index.js --quiet",
+		"lint": "jscs *.js */*.js"
 	},
 	"contributors": [
 		{
@@ -20,15 +21,15 @@
 		"clone",
 		"merge"
 	],
-	"repository" : {
+	"repository": {
 		"type": "git",
 		"url": "https://github.com/justmoon/node-extend.git"
 	},
-	"dependencies": {
-	},
+	"dependencies": {},
 	"devDependencies": {
-		"tape" : "~2.13.2",
-		"covert": "~0.4.0"
+		"tape": "~3.0.0",
+		"covert": "~1.0.0",
+		"jscs": "~1.6.2"
 	}
 }
 
diff --git a/test/index.js b/test/index.js
index f4fdde5..d646349 100644
--- a/test/index.js
+++ b/test/index.js
@@ -6,13 +6,16 @@ var int = 10;
 var arr = [1, 'what', new Date(81, 8, 4)];
 var date = new Date(81, 4, 13);
 
+var Foo = function () {};
+
 var obj = {
 	str: str,
 	int: int,
 	arr: arr,
 	date: date,
 	constructor: 'fake',
-	isPrototypeOf: 'not a function'
+	isPrototypeOf: 'not a function',
+    foo: new Foo()
 };
 
 var deep = {
@@ -44,15 +47,15 @@ test('merge string with string', function (t) {
 	var ori = 'what u gonna say';
 	var target = extend(ori, str);
 	var expectedTarget = {
-		'0': 'm',
-		'1': 'e',
-		'2': ' ',
-		'3': 'a',
-		'4': ' ',
-		'5': 't',
-		'6': 'e',
-		'7': 's',
-		'8': 't'
+		0: 'm',
+		1: 'e',
+		2: ' ',
+		3: 'a',
+		4: ' ',
+		5: 't',
+		6: 'e',
+		7: 's',
+		8: 't'
 	};
 
 	t.equal(ori, 'what u gonna say', 'original string 1 is unchanged');
@@ -78,9 +81,9 @@ test('merge string with array', function (t) {
 	t.equal(ori, 'what u gonna say', 'original string is unchanged');
 	t.deepEqual(arr, [1, 'what', new Date(81, 8, 4)], 'array is unchanged');
 	t.deepEqual(target, {
-		'0' : 1,
-		'1' : 'what',
-		'2' : new Date(81, 8, 4)
+		0: 1,
+		1: 'what',
+		2: new Date(81, 8, 4)
 	}, 'string + array is array');
 	t.end();
 });
@@ -107,7 +110,8 @@ test('merge string with obj', function (t) {
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
-		isPrototypeOf: 'not a function'
+		isPrototypeOf: 'not a function',
+		foo: new Foo()
 	};
 	t.deepEqual(obj, testObj, 'original obj is unchanged');
 	t.deepEqual(target, testObj, 'string + obj is obj');
@@ -121,15 +125,15 @@ test('merge number with string', function (t) {
 	t.equal(ori, 20, 'number is unchanged');
 	t.equal(str, 'me a test', 'string is unchanged');
 	t.deepEqual(target, {
-		'0': 'm',
-		'1': 'e',
-		'2': ' ',
-		'3': 'a',
-		'4': ' ',
-		'5': 't',
-		'6': 'e',
-		'7': 's',
-		'8': 't'
+		0: 'm',
+		1: 'e',
+		2: ' ',
+		3: 'a',
+		4: ' ',
+		5: 't',
+		6: 'e',
+		7: 's',
+		8: 't'
 	}, 'number + string is object form of string');
 	t.end();
 });
@@ -144,9 +148,9 @@ test('merge number with array', function (t) {
 
 	t.deepEqual(arr, [1, 'what', new Date(81, 8, 4)], 'array is unchanged');
 	t.deepEqual(target, {
-		'0': 1,
-		'1': 'what',
-		'2': new Date(81, 8, 4)
+		0: 1,
+		1: 'what',
+		2: new Date(81, 8, 4)
 	}, 'number + arr is object with array contents');
 	t.end();
 });
@@ -168,7 +172,8 @@ test('merge number with object', function (t) {
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
-		isPrototypeOf: 'not a function'
+		isPrototypeOf: 'not a function',
+		foo: new Foo()
 	};
 
 	t.deepEqual(obj, testObj, 'obj is unchanged');
@@ -183,15 +188,15 @@ test('merge array with string', function (t) {
 	t.deepEqual(ori, str.split(''), 'array is changed to be an array of string chars');
 	t.equal(str, 'me a test', 'string is unchanged');
 	t.deepEqual(target, {
-		'0': 'm',
-		'1': 'e',
-		'2': ' ',
-		'3': 'a',
-		'4': ' ',
-		'5': 't',
-		'6': 'e',
-		'7': 's',
-		'8': 't'
+		0: 'm',
+		1: 'e',
+		2: ' ',
+		3: 'a',
+		4: ' ',
+		5: 't',
+		6: 'e',
+		7: 's',
+		8: 't'
 	}, 'array + string is object form of string');
 	t.end();
 });
@@ -238,7 +243,8 @@ test('merge array with object', function (t) {
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
-		isPrototypeOf: 'not a function'
+		isPrototypeOf: 'not a function',
+		foo: new Foo()
 	};
 
 	t.deepEqual(obj, testObject, 'obj is unchanged');
@@ -260,15 +266,15 @@ test('merge date with string', function (t) {
 	var ori = new Date(81, 9, 20);
 	var target = extend(ori, str);
 	var testObject = {
-		'0': 'm',
-		'1': 'e',
-		'2': ' ',
-		'3': 'a',
-		'4': ' ',
-		'5': 't',
-		'6': 'e',
-		'7': 's',
-		'8': 't'
+		0: 'm',
+		1: 'e',
+		2: ' ',
+		3: 'a',
+		4: ' ',
+		5: 't',
+		6: 'e',
+		7: 's',
+		8: 't'
 	};
 
 	t.deepEqual(ori, testObject, 'date is changed to object form of string');
@@ -317,7 +323,8 @@ test('merge date with object', function (t) {
 		arr: [1, 'what', testDate],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
-		isPrototypeOf: 'not a function'
+		isPrototypeOf: 'not a function',
+		foo: new Foo()
 	};
 
 	t.deepEqual(obj, testObject, 'original object is unchanged');
@@ -336,15 +343,15 @@ test('merge object with string', function (t) {
 	};
 	var target = extend(ori, str);
 	var testObj = {
-		'0': 'm',
-		'1': 'e',
-		'2': ' ',
-		'3': 'a',
-		'4': ' ',
-		'5': 't',
-		'6': 'e',
-		'7': 's',
-		'8': 't',
+		0: 'm',
+		1: 'e',
+		2: ' ',
+		3: 'a',
+		4: ' ',
+		5: 't',
+		6: 'e',
+		7: 's',
+		8: 't',
 		str: 'no shit',
 		int: 76,
 		arr: [1, 2, 3, 4],
@@ -385,9 +392,9 @@ test('merge object with array', function (t) {
 	};
 	var target = extend(ori, arr);
 	var testObject = {
-		'0': 1,
-		'1': 'what',
-		'2': new Date(81, 8, 4),
+		0: 1,
+		1: 'what',
+		2: new Date(81, 8, 4),
 		str: 'no shit',
 		int: 76,
 		arr: [1, 2, 3, 4],
@@ -436,7 +443,8 @@ test('merge object with object', function (t) {
 		arr: [1, 'what', new Date(81, 8, 4)],
 		date: new Date(81, 4, 13),
 		constructor: 'fake',
-		isPrototypeOf: 'not a function'
+		isPrototypeOf: 'not a function',
+		foo: new Foo()
 	};
 	var expectedTarget = {
 		str: 'me a test',
@@ -445,7 +453,8 @@ test('merge object with object', function (t) {
 		date: new Date(81, 4, 13),
 		foo: 'bar',
 		constructor: 'fake',
-		isPrototypeOf: 'not a function'
+		isPrototypeOf: 'not a function',
+		foo: new Foo()
 	};
 
 	t.deepEqual(obj, expectedObj, 'obj is unchanged');
@@ -459,7 +468,12 @@ test('deep clone', function (t) {
 		str: 'no shit',
 		int: 76,
 		arr: [1, 2, 3, 4],
-		date: new Date(81, 7, 26)
+		date: new Date(81, 7, 26),
+		layer: {
+			deep: {
+				int: 42
+			}
+		}
 	};
 	var target = extend(true, ori, deep);
 
@@ -474,7 +488,8 @@ test('deep clone', function (t) {
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
-			isPrototypeOf: 'not a function'
+			isPrototypeOf: 'not a function',
+			foo: new Foo()
 		},
 		layer: {
 			int: 10,
@@ -496,7 +511,8 @@ test('deep clone', function (t) {
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
-			isPrototypeOf: 'not a function'
+			isPrototypeOf: 'not a function',
+			foo: new Foo()
 		},
 		layer: {
 			int: 10,
@@ -522,7 +538,8 @@ test('deep clone', function (t) {
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
-			isPrototypeOf: 'not a function'
+			isPrototypeOf: 'not a function',
+			foo: new Foo()
 		},
 		layer: {
 			int: 10,
@@ -546,7 +563,8 @@ test('deep clone', function (t) {
 			arr: [1, 'what', new Date(81, 8, 4)],
 			date: new Date(81, 4, 13),
 			constructor: 'fake',
-			isPrototypeOf: 'not a function'
+			isPrototypeOf: 'not a function',
+			foo: new Foo()
 		},
 		layer: {
 			int: 10,
@@ -570,10 +588,10 @@ test('deep clone; arrays are merged', function (t) {
 		arr: [1, 2, 3]
 	};
 	var override = {
-		arr: ["x"]
+		arr: ['x']
 	};
 	var expectedTarget = {
-		arr: ["x", 2, 3]
+		arr: ['x', 2, 3]
 	};
 
 	var target = extend(true, defaults, override);
@@ -602,3 +620,4 @@ test('pass in null; should create a valid object', function (t) {
 	t.deepEqual(target, override, 'null object handled normally');
 	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