value-includes

Get values including a string in an object or array

Usage no npm install needed!

<script type="module">
  import valueIncludes from 'https://cdn.skypack.dev/value-includes';
</script>

README

value-includes Build Status

Get values including a string in an object or array

Install

$ npm install --save value-includes

Usage

const valueIncludes = require('value-includes');

const obj = {
    a: 'ape',
    b: 'banana',
    c: 'captain'
}

valueIncludes(obj, 'n');
//=> {b: 'banana', c: 'captain'}

const arr = [
    'ape',
    'banana',
    'cat',
    'banana'
]

valueIncludes(arr, 'n');
//=> {1: 'banana', 3: 'banana'}

Related

  • value-is - Search for values in an object or array

License

MIT © Andreas Gillström