2.0.2 • Published 6 years ago
lagden-find v2.0.2
Encontre
Just find
Install
$ npm i -S lagden-findUsage
const encontre = require('lagden-find')
const collection = [{name: 'Sabrina', age: 27}, {name: 'Lagden', age: 28}]
const r = encontre(collection, 'name', 'sa', {caseSensitive: false})
console.log(r) // [{name: 'Sabrina', age: 27}]API
encontre(collection, k, q, options)
| parameter | type | required | default | description |
|---|---|---|---|---|
| collection | array | yes | - | An array of objects - see example |
| k | string | yes | - | The key of object which you would like to search |
| q | string | yes | - | The term that you looking for |
| options | object | no | see below | Options |
options
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| split | boolean | no | true | Break the term in many words |
| caseSensitive | boolean | no | true | The words can differ in meaning |
License
MIT © Thiago Lagden