Comparing version 1.0.7 to 1.0.8
@@ -289,15 +289,18 @@ import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2'; | ||
nodes.forEach(function (node) { | ||
if (isMatch(node)) { | ||
matchNodes.push(node); | ||
} else { | ||
if (node[childKey] && node[childKey].length) { | ||
var childs = loop(node[childKey]); | ||
var childs = []; | ||
if (childs.length) { | ||
// add matched childs only | ||
var newNode = _objectSpread(_objectSpread({}, node), {}, _defineProperty({}, childKey, childs)); | ||
if (node[childKey] && node[childKey].length) { | ||
childs = loop(node[childKey]); | ||
} | ||
matchNodes.push(newNode); | ||
} | ||
} | ||
if (childs.length) { | ||
// add matched childs only | ||
var newNode = _objectSpread(_objectSpread({}, node), {}, _defineProperty({}, childKey, childs)); | ||
matchNodes.push(newNode); | ||
} else if (isMatch(node)) { | ||
var _newNode = _objectSpread({}, node); | ||
delete _newNode[childKey]; | ||
matchNodes.push(_newNode); | ||
} | ||
@@ -304,0 +307,0 @@ }); |
@@ -5,17 +5,2 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
@@ -26,6 +11,5 @@ var keys = Object.keys(object); | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
@@ -38,15 +22,8 @@ | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
@@ -57,2 +34,17 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _toConsumableArray(arr) { | ||
@@ -431,15 +423,18 @@ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
nodes.forEach(function (node) { | ||
if (isMatch(node)) { | ||
matchNodes.push(node); | ||
} else { | ||
if (node[childKey] && node[childKey].length) { | ||
var childs = loop(node[childKey]); | ||
var childs = []; | ||
if (childs.length) { | ||
// add matched childs only | ||
var newNode = _objectSpread2(_objectSpread2({}, node), {}, _defineProperty({}, childKey, childs)); | ||
if (node[childKey] && node[childKey].length) { | ||
childs = loop(node[childKey]); | ||
} | ||
matchNodes.push(newNode); | ||
} | ||
} | ||
if (childs.length) { | ||
// add matched childs only | ||
var newNode = _objectSpread2(_objectSpread2({}, node), {}, _defineProperty({}, childKey, childs)); | ||
matchNodes.push(newNode); | ||
} else if (isMatch(node)) { | ||
var _newNode = _objectSpread2({}, node); | ||
delete _newNode[childKey]; | ||
matchNodes.push(_newNode); | ||
} | ||
@@ -446,0 +441,0 @@ }); |
{ | ||
"name": "treedash", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A Tree Utils Library For Development", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33809
904