Skip to content

Commit c3734d9

Browse files
committed
release for version 0.6.2
2 parents 6fd0cc3 + 86481e2 commit c3734d9

13 files changed

+208
-93
lines changed

.babelrc

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
11
{
2-
"stage": 0,
3-
"loose": "all",
42
"plugins": [
5-
"babel-plugin-espower"
3+
"check-es2015-constants",
4+
"transform-es2015-parameters",
5+
"transform-es2015-block-scoping",
6+
[
7+
"transform-es2015-arrow-functions", {
8+
"spec": true
9+
}
10+
],
11+
[
12+
"transform-es2015-computed-properties", {
13+
"loose": true
14+
}
15+
],
16+
[
17+
"transform-es2015-template-literals", {
18+
"loose": true,
19+
"spec": true
20+
}
21+
],
22+
"add-module-exports",
23+
[
24+
"transform-es2015-modules-commonjs", {
25+
"loose": true
26+
}
27+
],
28+
[
29+
"transform-strict-mode", {
30+
"strict": true
31+
}
32+
],
33+
"transform-undefined-to-void",
34+
"transform-es3-property-literals",
35+
"transform-es3-member-expression-literals",
36+
"espower"
637
]
738
}

.eslintignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
./build/deepcopy.js
2-
./build/deepcopy.min.js
3-
./lib
1+
build/deepcopy.js
2+
build/deepcopy.min.js
3+
index.js
4+
lib/
5+
webpack.config.js
File renamed without changes.

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.babelrc
22
.eslintignore
3-
.eslintrc
3+
.eslintrc.yaml
44
.gitignore
55
.travis.yml
66
karma.conf.coffee

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ node_js:
55
- "0.10"
66
- "0.11"
77
- "0.12"
8-
- "4.2"
9-
- "5.3"
8+
- "4"
9+
- "5"
10+
- "6"
1011

1112
sudo: false
1213

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.6.2 / 2016-06-12
2+
3+
- fixed #10
4+
15
# 0.6.1 / 2016-01-13
26

37
- fixed #9

build/deepcopy.js

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,20 @@ return /******/ (function(modules) { // webpackBootstrap
7979
return false;
8080
};
8181

82-
var getKeys = Object.keys ? function getKeys(obj) {
82+
var getKeys = typeof Object.keys === 'function' ? function getKeys(obj) {
8383
return Object.keys(obj);
8484
} : function getKeys(obj) {
8585
var objType = typeof obj;
8686

87-
if (obj === null || objType !== 'function' || objType !== 'object') {
87+
if (obj === null || objType !== 'function' && objType !== 'object') {
8888
throw new TypeError('obj must be an Object');
8989
}
9090

9191
var resultKeys = [],
92-
key = undefined;
92+
key = void 0;
9393

9494
for (key in obj) {
95-
obj.hasOwnProperty(key) && resultKeys.push(key);
95+
Object.prototype.hasOwnProperty.call(obj, key) && resultKeys.push(key);
9696
}
9797

9898
return resultKeys;
@@ -116,31 +116,31 @@ return /******/ (function(modules) { // webpackBootstrap
116116
throw new TypeError('array must be an Array');
117117
}
118118

119-
var i = undefined,
120-
len = undefined,
121-
value = undefined;
119+
var i = void 0,
120+
len = void 0,
121+
value = void 0;
122122

123123
for (i = 0, len = array.length; i < len; ++i) {
124124
value = array[i];
125125

126-
// it is SameValue algorithm
127-
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
126+
// NOTE:
127+
//
128+
// it is SameValue algorithm
129+
// http://stackoverflow.com/questions/27144277/comparing-a-variable-with-itself
130+
//
131+
// eslint-disable-next-line no-self-compare
128132
if (value === s || value !== value && s !== s) {
129-
// eslint-disable-line no-self-compare
130133
return i;
131134
}
132135
}
133136

134137
return -1;
135138
}
136139

137-
exports['default'] = {
138-
getKeys: getKeys,
139-
getSymbols: getSymbols,
140-
indexOf: indexOf,
141-
isBuffer: isBuffer
142-
};
143-
module.exports = exports['default'];
140+
exports.getKeys = getKeys;
141+
exports.getSymbols = getSymbols;
142+
exports.indexOf = indexOf;
143+
exports.isBuffer = isBuffer;
144144

145145
/***/ },
146146
/* 2 */
@@ -149,6 +149,7 @@ return /******/ (function(modules) { // webpackBootstrap
149149
'use strict';
150150

151151
exports.__esModule = true;
152+
exports.copyValue = exports.copyCollection = exports.copy = void 0;
152153

153154
var _polyfill = __webpack_require__(1);
154155

@@ -206,7 +207,7 @@ return /******/ (function(modules) { // webpackBootstrap
206207
return target;
207208
} else {
208209
// user defined function
209-
return new Function('return ' + source)();
210+
return new Function('return ' + String(source))();
210211
}
211212
}
212213

@@ -236,7 +237,7 @@ return /******/ (function(modules) { // webpackBootstrap
236237
// +date; // 1420909757913
237238
// +new Date(date); // 1420909757913
238239
// +new Date(+date); // 1420909757913
239-
return new Date(+target);
240+
return new Date(target.getTime());
240241
}
241242

242243
if (targetClass === '[object RegExp]') {
@@ -256,7 +257,7 @@ return /******/ (function(modules) { // webpackBootstrap
256257
return new RegExp(regexpText.slice(1, slashIndex), regexpText.slice(slashIndex + 1));
257258
}
258259

259-
if (_polyfill.isBuffer(target)) {
260+
if ((0, _polyfill.isBuffer)(target)) {
260261
var buffer = new Buffer(target.length);
261262

262263
target.copy(buffer);
@@ -285,12 +286,9 @@ return /******/ (function(modules) { // webpackBootstrap
285286
return null;
286287
}
287288

288-
exports['default'] = {
289-
copy: copy,
290-
copyCollection: copyCollection,
291-
copyValue: copyValue
292-
};
293-
module.exports = exports['default'];
289+
exports.copy = copy;
290+
exports.copyCollection = copyCollection;
291+
exports.copyValue = copyValue;
294292

295293
/***/ },
296294
/* 3 */
@@ -309,21 +307,21 @@ return /******/ (function(modules) { // webpackBootstrap
309307
}
310308

311309
function deepcopy(target) {
312-
var customizer = arguments.length <= 1 || arguments[1] === undefined ? defaultCustomizer : arguments[1];
310+
var customizer = arguments.length <= 1 || arguments[1] === void 0 ? defaultCustomizer : arguments[1];
313311

314312
if (target === null) {
315313
// copy null
316314
return null;
317315
}
318316

319-
var resultValue = _copy.copyValue(target);
317+
var resultValue = (0, _copy.copyValue)(target);
320318

321319
if (resultValue !== null) {
322320
// copy some primitive types
323321
return resultValue;
324322
}
325323

326-
var resultCollection = _copy.copyCollection(target, customizer),
324+
var resultCollection = (0, _copy.copyCollection)(target, customizer),
327325
clone = resultCollection !== null ? resultCollection : target;
328326

329327
var visited = [target],
@@ -339,37 +337,39 @@ return /******/ (function(modules) { // webpackBootstrap
339337
return null;
340338
}
341339

342-
var resultValue = _copy.copyValue(target);
340+
var resultValue = (0, _copy.copyValue)(target);
343341

344342
if (resultValue !== null) {
345343
// copy some primitive types
346344
return resultValue;
347345
}
348346

349-
var keys = _polyfill.getKeys(target).concat(_polyfill.getSymbols(target));
347+
var keys = (0, _polyfill.getKeys)(target).concat((0, _polyfill.getSymbols)(target));
350348

351-
var i = undefined,
352-
len = undefined;
349+
var i = void 0,
350+
len = void 0;
353351

354-
var key = undefined,
355-
value = undefined,
356-
index = undefined,
357-
resultCopy = undefined,
358-
result = undefined,
359-
ref = undefined;
352+
var key = void 0,
353+
value = void 0,
354+
index = void 0,
355+
resultCopy = void 0,
356+
result = void 0,
357+
ref = void 0;
360358

361359
for (i = 0, len = keys.length; i < len; ++i) {
362360
key = keys[i];
363361
value = target[key];
364-
index = _polyfill.indexOf(visited, value);
362+
index = (0, _polyfill.indexOf)(visited, value);
365363

366364
if (index === -1) {
367-
resultCopy = _copy.copy(value, customizer);
365+
resultCopy = (0, _copy.copy)(value, customizer);
368366
result = resultCopy !== null ? resultCopy : value;
369367

370368
if (value !== null && /^(?:function|object)$/.test(typeof value)) {
371369
visited.push(value);
372370
reference.push(result);
371+
} else {
372+
ref = result;
373373
}
374374
} else {
375375
// circular reference

build/deepcopy.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "deepcopy",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"author": "sasa+1 <[email protected]>",
55
"contributors": [
66
"kjirou <[email protected]>"
@@ -15,40 +15,54 @@
1515
},
1616
"scripts": {
1717
"babel": "babel --out-dir ./lib ./src",
18-
"build": "npm ru clean && npm ru babel && npm ru compile && npm ru minify",
19-
"clean": "npm ru rimraf -- ./build ./lib",
20-
"compile": "npm ru webpack -- --output-filename ./build/deepcopy.js",
21-
"develop": " parallelshell 'npm ru babel -- -w' 'npm ru compile -- -w' 'npm ru minify -- -w'",
18+
"build": "npm run clean && npm run babel && npm run compile && npm run minify",
19+
"clean": "npm run rimraf -- ./build ./lib",
20+
"compile": "npm run webpack -- --output-filename ./build/deepcopy.js",
21+
"develop": " parallelshell 'npm run babel -- -w' 'npm run compile -- -w' 'npm run minify -- -w'",
2222
"eslint": "eslint",
2323
"karma": "karma",
24-
"lint": "npm ru eslint -- --ext .js .",
25-
"minify": "npm ru webpack -- --optimize-minimize --output-filename ./build/deepcopy.min.js",
24+
"lint": "npm run eslint -- --ext .js .",
25+
"minify": "npm run webpack -- --optimize-minimize --output-filename ./build/deepcopy.min.js",
2626
"mocha": "mocha",
27-
"posttest": "npm ru karma -- start --single-run --browsers Chrome,Firefox,Safari",
28-
"prepublish": "npm ru build",
27+
"posttest": "npm run karma -- start --single-run --browsers Chrome,Firefox,Safari",
28+
"prepublish": "npm run build",
2929
"rimraf": "rimraf",
30-
"test": "npm ru mocha",
31-
"travis": "npm ru mocha",
30+
"test": "npm run mocha",
31+
"travis": "npm run mocha",
3232
"webpack": "webpack --colors --display-error-details --progress"
3333
},
3434
"devDependencies": {
35-
"babel": "5.8.34",
36-
"babel-eslint": "4.1.6",
37-
"babel-loader": "5.3.3",
38-
"babel-plugin-espower": "1.0.1",
35+
"babel": "^6.5.2",
36+
"babel-cli": "^6.6.5",
37+
"babel-core": "^6.7.2",
38+
"babel-eslint": "^6.0.4",
39+
"babel-loader": "^6.2.4",
40+
"babel-plugin-add-module-exports": "^0.2.1",
41+
"babel-plugin-check-es2015-constants": "^6.7.2",
42+
"babel-plugin-espower": "^2.1.2",
43+
"babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
44+
"babel-plugin-transform-es2015-block-scoping": "^6.7.1",
45+
"babel-plugin-transform-es2015-computed-properties": "^6.6.5",
46+
"babel-plugin-transform-es2015-modules-commonjs": "^6.7.0",
47+
"babel-plugin-transform-es2015-parameters": "^6.7.0",
48+
"babel-plugin-transform-es2015-template-literals": "^6.6.5",
49+
"babel-plugin-transform-es3-member-expression-literals": "^6.5.0",
50+
"babel-plugin-transform-es3-property-literals": "^6.5.0",
51+
"babel-plugin-transform-strict-mode": "^6.6.5",
52+
"babel-plugin-transform-undefined-to-void": "^6.5.0",
3953
"coffee-script": "^1.10.0",
40-
"eslint": "^1.10.3",
41-
"eslint-config-sasaplus1": "git://github.com/sasaplus1-prototype/eslint-config-sasaplus1.git",
42-
"espower-babel": "3.3.0",
54+
"eslint": "^2.4.0",
55+
"eslint-config-sasaplus1": "sasaplus1-prototype/eslint-config-sasaplus1.git",
56+
"espower-babel": "4.0.3",
4357
"karma": "^0.13.15",
44-
"karma-chrome-launcher": "^0.2.2",
45-
"karma-firefox-launcher": "^0.1.7",
46-
"karma-mocha": "^0.2.1",
47-
"karma-safari-launcher": "^0.1.1",
58+
"karma-chrome-launcher": "^1.0.1",
59+
"karma-firefox-launcher": "^1.0.0",
60+
"karma-mocha": "^1.0.1",
61+
"karma-safari-launcher": "^1.0.0",
4862
"karma-webpack": "^1.7.0",
4963
"mocha": "^2.3.4",
5064
"parallelshell": "^2.0.0",
51-
"power-assert": "^1.2.0",
65+
"power-assert": "^1.3.1",
5266
"rimraf": "^2.4.4",
5367
"webpack": "^1.12.9"
5468
}

src/copy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function copyCollection(target, customizer) {
8484
// +date; // 1420909757913
8585
// +new Date(date); // 1420909757913
8686
// +new Date(+date); // 1420909757913
87-
return new Date(+target);
87+
return new Date(target.getTime());
8888
}
8989

9090
if (targetClass === '[object RegExp]') {
@@ -136,7 +136,7 @@ function copyValue(target) {
136136
return null;
137137
}
138138

139-
export default {
139+
export {
140140
copy,
141141
copyCollection,
142142
copyValue,

0 commit comments

Comments
 (0)