README
Is in list?
Returns whether a certain item is in the provided list.
Install
$ npm i is-in-list
Usage
'use strict';
var isInList = require('is-in-list');
var listOfAwesomePeople = [
{ name: 'Sabrina' },
{ name: 'Gustav' },
{ name: 'Mattias' },
];
console.log('is Sabrina awesome?', isInList(listOfAwesomePeople, { name: 'Sabrina' }));
With curry
-ing:
'use strict';
var not = require('not');
var isInList = require('is-in-list');
var paramsBlackList = [
'skip',
'link',
'page',
'sort',
'embed',
'limit',
'fields',
'pagination',
];
var query = {
foo: 'bar',
baz: 'qnx',
sort: '-foo',
};
var acceptedParams = Object
.keys(query)
.filter(not(isInList(paramsBlackList)));
console.log('accepted param keys are:', acceptedParams);
Reasoning
underscore
/ lodash
/ ramda
/ <insert functional library here>
Why use this and not Because what I'm looking for is simpler than what any of those libraries have to offer. Please think of this library as a simple experiment of re-inventing the wheel to see how it works :)