Comparing version 1.0.8 to 1.0.9
@@ -88,2 +88,5 @@ 'use strict'; | ||
var keyEnd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ']'; | ||
var _this = this; | ||
var separator = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '|'; | ||
@@ -114,11 +117,4 @@ var strict = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; | ||
texts.forEach(function (text) { | ||
if (strict) { | ||
if (_lodash2.default.toUpper(item[key]) === _lodash2.default.toUpper(text)) found = true; | ||
} else { | ||
if (_lodash2.default.toUpper(item[key]).indexOf(_lodash2.default.toUpper(text)) !== -1) { | ||
found = true; | ||
} | ||
} | ||
if (_this.foundText(item[key], text, strict)) found = true; | ||
}); | ||
return found; | ||
@@ -129,11 +125,4 @@ }); | ||
collection = collection.filter(function (item) { | ||
if (strict) { | ||
if (_lodash2.default.toUpper(item[key]) === _lodash2.default.toUpper(text)) return true; | ||
} else { | ||
if (_lodash2.default.toUpper(item[key]).indexOf(_lodash2.default.toUpper(text)) !== -1) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
return _this.foundText(item[key], text, strict); | ||
}); | ||
@@ -145,2 +134,28 @@ } | ||
} | ||
/** | ||
* Check if a string contains a substring. | ||
* If stric is true, both values must be equals. | ||
* @param string | ||
* @param search | ||
* @param strict | ||
* @return {boolean} | ||
*/ | ||
}, { | ||
key: 'foundText', | ||
value: function foundText(string, search, strict) { | ||
if (strict) { | ||
if (_lodash2.default.toUpper(string) === _lodash2.default.toUpper(search)) return true; | ||
} else { | ||
var pos = _lodash2.default.toUpper(string).indexOf(_lodash2.default.toUpper(search)); | ||
if (pos !== -1) { | ||
if (search === '') { | ||
return _lodash2.default.toUpper(string) === _lodash2.default.toUpper(search); | ||
} else return true; | ||
} | ||
} | ||
return false; | ||
} | ||
}]); | ||
@@ -147,0 +162,0 @@ |
{ | ||
"name": "psl-core", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Core Library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
602573
18
16677
1