Socket
Socket
Sign inDemoInstall

@smakss/search

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smakss/search - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "@smakss/search",
"version": "1.0.1",
"version": "1.0.2",
"description": "Search through array and/or objects for sepcific keyword.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -20,3 +20,3 @@ # UUID

```
var search = require('@smakss/search');
var Search = require('@smakss/search');
```

@@ -27,3 +27,3 @@

```
import search from '@smakss/search';
import Search from '@smakss/search';
```

@@ -38,3 +38,3 @@

- `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.
- `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.

@@ -48,3 +48,3 @@ ## Examples of usage

search({ searchText: "john", searchItems: array });
Search({ searchText: "john", searchItems: array });

@@ -61,3 +61,3 @@ // Result: [{ lastName: "Doe", name: "John" }]

search({ searchText: "john", searchItems: arr });
Search({ searchText: "john", searchItems: arr });

@@ -75,3 +75,3 @@ // Result: [{ lastName: "Doe", name: "John" }]

search({ searchText: "jane", searchItems: arr });
Search({ searchText: "jane", searchItems: arr });

@@ -81,4 +81,31 @@ // Result: [{ lastName: "Doe", name: "Jane" }]

**Passing a nested array with including keys:**
```
const arr = [
{ name: "John", lastName: "Doe" },
{ name: "Joe", lastName: "Doe" },
[{ name: "Jane", lastName: "Doe" }]
];
Search({ searchText: "jane", searchItems: arr, keys: ['name'] });
// Result: [{ lastName: "Doe", name: "Jane" }]
```
**Passing a nested array with excluding keys:**
```
const arr = [
{ name: "John", lastName: "Doe" },
{ name: "Joe", lastName: "Doe" },
[{ name: "Jane", lastName: "Doe" }]
];
Search({ searchText: "jane", searchItems: arr, keys: ['name'], include: false });
// Result: []
// The result will be an empty array when nothing matches with the provided params
```
## Demo
You can check the [working demo](https://runkit.com/smakss/search) in runkit.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc