1.0.2 • Published 4 years ago
k_array v1.0.2
k_array
This package is still under development.
k_array makes it easier to work with arrays. New functions will come soon..
Install
$ npm install k_array
Import
const k_search = require('k_array');
// or
import k_search from 'k_array';
Usage
k_search(array, key, value)
const myArray = [
{
id: 1,
text: 'hello',
description: 'first item'
},
{
id: 2,
text: 'world',
description: 'second item'
},
{
id: 3,
text: 'hello world',
description: 'third item'
},
];
console.log(k_search(myArray, 'text', 'hello'));
// Returns item 1 and 3
console.log(k_search(myArray, 'description', 'first'));
// Returns item 1