2.0.0 • Published 1 year ago

has-match v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

has-match

Check object value for match

Install

npm install has-match

Usage

import hasMatch from 'has-match'

const garden = {
	name: 'Sunny Fields',
	plants: ['roses', 'lilies', 'gerberas'],
}

hasMatch(garden, 'gerb')
// => true

hasMatch(garden, 'sunny fields')
// => true

hasMatch(garden, 'sunny fields', ['plants'])
// => false

Filter

const gardens = [
	{
		name: 'Sunny Fields',
		plants: ['roses', 'lilies', 'gerberas'],
	},
	{
		name: 'Moony Meadows',
		plants: ['cosmos', 'lilies', 'mushrooms'],
	},
]

gardens.filter((garden) => hasMatch(garden, 'cosmos'))
// => [{ name: 'Moony Meadows', plants: ['cosmos', 'lilies', 'mushrooms'] }]
1.0.6

1 year ago

1.0.5

1 year ago

2.0.0

1 year ago

1.0.4

3 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago