A lightweight, zero dependency set of tools that i use in almost any project
-
Install with your favorite package manager:
- npm :
npm i @igortrindade/lazyfy
- yarn :
yarn add @igortrindade/lazyfy
- npm :
-
Usage
import { ArrayHelpers } from '@igortrindade/lazyfy'
const arr = ['watermelon', 'strawberry', 'grape']
const item = ArrayHelpers.find(arr, 'grape')
// item = 'grape'
const books = [ { id: 1, title: 'Clean Code' }, { id: 2, title: 'Clean Archtecture' }, { id: 3, title: 'Refactoring' }]
const selected = ArrayHelpers.findAll(books, { id: [1, 2]})
// selected = [ { id: 1, title: 'Clean Code' }, { id: 2, title: 'Clean Archtecture' }]
const bookClean = ArrayHelpers.find(books, { title: 'CLEAN CODE' })
// Case insensitive match
// bookClean = { id: 1, title: 'Clean Code' }
// For more examples, see the live playground on: https://igortrinidad.github.io/lazyfy/
Run into a problem? Open an issue. Want to add some feature? PRs are welcome!
Feel free to contact me:
Copyright © 2022 Igor Trindade.
This project is under MIT license.