Skip to content

Commit

Permalink
@recursive/assign remove trailing commas for node 6
Browse files Browse the repository at this point in the history
  • Loading branch information
omrilotan committed Apr 2, 2020
1 parent f3f6191 commit f1036e3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 30 deletions.
12 changes: 5 additions & 7 deletions packages/assign/lib/assignArray/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ const assignable = require('../assignable');
* no return value
*/
module.exports = function assignArray(target, source) {
source.forEach(
(item, index) => assignable(target[index]) && assignable(item)
? require('../assign')(target[index], item)
: target[index] = item === undefined
? target[index]
: item,
);
source.forEach((item, index) => assignable(target[index]) && assignable(item)
? require('../assign')(target[index], item)
: target[index] = item === undefined
? target[index]
: item);
};
6 changes: 1 addition & 5 deletions packages/assign/lib/assignKey/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const assignable = require('../assignable');
const clone = require('../clone');

const secureKeys = [
'__proto__',
'constructor',
'prototype',
];
const secureKeys = [ '__proto__', 'constructor', 'prototype' ];

/**
* assign one key from one object to the target
Expand Down
2 changes: 1 addition & 1 deletion packages/assign/lib/assignMap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* @param {Map} source The Map from which to assign respective values
* no return value
*/
module.exports = (target, source) => source.forEach((key,value) => target.set(value,key));
module.exports = (target, source) => source.forEach((key, value) => target.set(value, key));
4 changes: 1 addition & 3 deletions packages/assign/lib/assignSet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ module.exports = function assignSet(target, source) {
assignArray(array, Array.from(source));

target.clear();
array.forEach(
item => target.add(item),
);
array.forEach(item => target.add(item));
};
14 changes: 1 addition & 13 deletions packages/assign/lib/typeMatchers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,4 @@
* @member {Function} isMap
* @member {Function} isSet
*/
module.exports = [
[Map, 'Map'],
[Set, 'Set'],
].reduce(
(accumulator, [constructor, name]) => Object.assign(
accumulator,
{
[`is${name}`]: item => item instanceof constructor || (item && typeof item.toString === 'function' && item.toString() === `[object ${name}]`),
},
),
{},
);

module.exports = [ [Map, 'Map'], [Set, 'Set'] ].reduce((accumulator, [constructor, name]) => Object.assign(accumulator, { [`is${name}`]: item => item instanceof constructor || (item && typeof item.toString === 'function' && item.toString() === `[object ${name}]`) }), {});
2 changes: 1 addition & 1 deletion packages/assign/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@recursive/assign",
"version": "2.0.1",
"version": "2.0.2",
"description": "Recursive assign for objects, arrays and more",
"keywords": [
"deep",
Expand Down

0 comments on commit f1036e3

Please sign in to comment.