Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "fuzzytree", | ||
"main": "dist/FuzzyTree.js", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "https://github.com/EyalAr/FuzzyTree", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -137,7 +137,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (!(0, _lodash.isArray)(path)) throw Error('path must be an array or a string'); | ||
if (!path.every(_lodash.isString)) throw Error('all path sections must be strings'); | ||
if (path.some(function (s) { | ||
if (!(0, _lodash.every)(path, _lodash.isString)) throw Error('all path sections must be strings'); | ||
if ((0, _lodash.some)(path, function (s) { | ||
return s.length === 0; | ||
})) throw Error('path section cannot be empty'); | ||
if (path.some(function (s) { | ||
if ((0, _lodash.some)(path, function (s) { | ||
return s === _this._wildcard || s === _this._greedy; | ||
@@ -177,7 +177,7 @@ })) throw Error('path section cannot be a wildcard'); | ||
function traverseGreedy(child) { | ||
var grandchilds = Object.keys(child._children), | ||
var grandchilds = (0, _lodash.keys)(child._children), | ||
wildcard = child._wildcard, | ||
greedy = child._greedy; | ||
if (!grandchilds.length) _push(res, child._match([]));else { | ||
grandchilds.forEach(function (gc) { | ||
(0, _lodash.forEach)(grandchilds, function (gc) { | ||
if (gc === wildcard) { | ||
@@ -213,4 +213,4 @@ // consume as much as possible, only if at least two left | ||
if (!(0, _lodash.isArray)(path)) throw Error('path must be an array or a string'); | ||
if (!path.every(_lodash.isString)) throw Error('all path sections must be strings'); | ||
if (path.some(function (s) { | ||
if (!(0, _lodash.every)(path, _lodash.isString)) throw Error('all path sections must be strings'); | ||
if ((0, _lodash.some)(path, function (s) { | ||
return s.length === 0; | ||
@@ -227,3 +227,3 @@ })) throw Error('path section cannot be empty'); | ||
return this._children[path[0]].find(path.slice(1)); | ||
return this._children[path[0]]._find(path.slice(1)); | ||
} | ||
@@ -243,4 +243,4 @@ }, { | ||
if (!(0, _lodash.isArray)(path)) throw Error('path must be an array or a string'); | ||
if (!path.every(_lodash.isString)) throw Error('all path sections must be strings'); | ||
if (path.some(function (s) { | ||
if (!(0, _lodash.every)(path, _lodash.isString)) throw Error('all path sections must be strings'); | ||
if ((0, _lodash.some)(path, function (s) { | ||
return s.length === 0; | ||
@@ -268,3 +268,3 @@ })) throw Error('path section cannot be empty'); | ||
return this._children[path[0]].insert(path.slice(1)); | ||
return this._children[path[0]]._insert(path.slice(1)); | ||
} | ||
@@ -277,3 +277,3 @@ }]); | ||
function _push(target, elements) { | ||
elements.forEach(function (e) { | ||
(0, _lodash.forEach)(elements, function (e) { | ||
return target.push(e); | ||
@@ -280,0 +280,0 @@ }); |
{ | ||
"name": "fuzzytree", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Fuzzy tree structure with non-deterministic nodes paths", | ||
@@ -5,0 +5,0 @@ "main": "dist/FuzzyTree.js", |
@@ -6,3 +6,7 @@ /* jshint esnext:true */ | ||
isArray as _isArray, | ||
lastIndexOf as _lastIndexOf | ||
lastIndexOf as _lastIndexOf, | ||
keys as _keys, | ||
forEach as _forEach, | ||
every as _every, | ||
some as _some | ||
} from 'lodash'; | ||
@@ -63,7 +67,7 @@ | ||
throw Error("path must be an array or a string"); | ||
if (!path.every(_isString)) | ||
if (!_every(path, _isString)) | ||
throw Error("all path sections must be strings"); | ||
if (path.some(s => s.length === 0)) | ||
if (_some(path, s => s.length === 0)) | ||
throw Error("path section cannot be empty"); | ||
if (path.some(s => s === this._wildcard || s === this._greedy)) | ||
if (_some(path, s => s === this._wildcard || s === this._greedy)) | ||
throw Error("path section cannot be a wildcard"); | ||
@@ -102,3 +106,3 @@ | ||
function traverseGreedy(child){ | ||
var grandchilds = Object.keys(child._children), | ||
var grandchilds = _keys(child._children), | ||
wildcard = child._wildcard, | ||
@@ -108,3 +112,3 @@ greedy = child._greedy; | ||
else { | ||
grandchilds.forEach(gc => { | ||
_forEach(grandchilds, gc => { | ||
if (gc === wildcard) { | ||
@@ -139,5 +143,5 @@ // consume as much as possible, only if at least two left | ||
throw Error("path must be an array or a string"); | ||
if (!path.every(_isString)) | ||
if (!_every(path, _isString)) | ||
throw Error("all path sections must be strings"); | ||
if (path.some(s => s.length === 0)) | ||
if (_some(path, s => s.length === 0)) | ||
throw Error("path section cannot be empty"); | ||
@@ -152,3 +156,3 @@ | ||
return this._children[path[0]].find(path.slice(1)); | ||
return this._children[path[0]]._find(path.slice(1)); | ||
} | ||
@@ -167,5 +171,5 @@ | ||
throw Error("path must be an array or a string"); | ||
if (!path.every(_isString)) | ||
if (!_every(path, _isString)) | ||
throw Error("all path sections must be strings"); | ||
if (path.some(s => s.length === 0)) | ||
if (_some(path, s => s.length === 0)) | ||
throw Error("path section cannot be empty"); | ||
@@ -191,3 +195,3 @@ | ||
return this._children[path[0]].insert(path.slice(1)); | ||
return this._children[path[0]]._insert(path.slice(1)); | ||
} | ||
@@ -197,5 +201,5 @@ } | ||
function _push(target, elements){ | ||
elements.forEach(e => target.push(e)); | ||
_forEach(elements, e => target.push(e)); | ||
} | ||
export default FuzzyTree; |
Sorry, the diff of this file is not supported yet
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
53296
876