.removeValues()
.lowerCase()
.searchFor()var cleanWords = new cleanSearch([*values*]); Removes all the following unwanted values:
undefined
NaN
nullBy default the values which you use for the setup are automatically cleaned
var cleanWords = new cleanSearch([
123,
null,
{
a: NaN,
b: {
c: [null,undefined,NaN,"abc"]
}
}
]);
console.log(cleanWords.values);
// The output: [123,{ a: "", b: { c: ["abc"] }}]
// Another example
console.log(cleanWords.cleanValues(["def",123,null]));
// The output: ["def",123]NOTE: The unwanted values in Object's are replaced with "" (empty quotes)
.lowerCase() method replaces all string values with lower case versions of that values. If you use it without a parameter it lowerCases its own values
var cleanWords = new cleanSearch(["ABC","SES", {
a: "HEY",
b: {
c: ["LUL",["DEF", {
d: "FOO"
}]]
}
}]);
// ["abc", "ses", { a:"hey", b:{c:["lul", ["def", {d:"foo" }]]}}]Searches for the given value, returns true if the value exists
var cleanWords = new cleanSearch(["ABC","SES", {
a: "HEY",
b: {
c: ["LUL",["DEF", {
d: "FOO"
}]]
}
}]);
console.log(cleanWords.searchFor("foo")); // trueNOTE: .searchFor() function executes .lowerCase() before starting the search