UNPKG

ab-helpers

Version:

A collection of helper functions for various tasks

19 lines (15 loc) 387 B
const getSize = (array) => array && array.length; const contains = (items, key, value) => !!items.find((item) => item[key] === value); const filterByKeys = (items, keys, value) => items.filter((item) => keys.some( (key) => item[key] && item[key].toLowerCase().includes(value.toLowerCase()) ) ); module.exports = { getSize, contains, filterByKeys, };