@smakss/search
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "@smakss/search", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Search through array and/or objects for sepcific keyword.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -36,3 +36,4 @@ # Search | ||
- `keys` (`Array`): Keys to include or exclude in your object items. If you exclude them it will exclude them from search and search won't perform on those specific keys. And if you include them search will only perform on those desired keys and it will ignore others. | ||
- `include` (`Boolean`): A flag to determine whether the `keys` are included or excluded. It will be `True` by default, which means the keys will be included. | ||
- `include` (`Boolean`): A flag to determine whether the `keys` are included or excluded. It will be `True` by default, which means the keys will be included. | ||
- `exact` (`Boolean`): A flag to determine whether the you are exactly looking for `searchText` string or not. It will be `False` by default, which means it will not looking for exact `searchText`. e. g. Let's say `searchText` is `5` so it will match all numbers where they include `5` *(`5`, `15`, `25`, ...)* otherwise it will only match `5` alone. This feature is only available in `v1.0.6+`. | ||
@@ -103,4 +104,18 @@ ## Examples of usage | ||
**Passing a nested array with exact search *(Only available in `v1.0.6+`)*:** | ||
``` | ||
const arr = [ | ||
{ name: "John", lastName: "Doe" }, | ||
{ name: "Janet", lastName: "Doe" }, | ||
[{ name: "Jane", lastName: "Doe" }] | ||
]; | ||
Search({ searchText: "jane", searchItems: arr, exact: true }); | ||
// Result: [{ name: "Jane", lastName: "Doe" }] | ||
// It will only match Jane and not Janet | ||
``` | ||
## Demo | ||
You can check the [working demo](https://runkit.com/smakss/5f738b7f464579001bfda2d0) in runkit. |
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
9473
68
119