Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brh55/arr-u-legit
🤔 Strict compare an unsure array against a set of valid values to check if it's legit
https://github.com/brh55/arr-u-legit
array-helper comparison nodejs strict-comparisons
Last synced: 27 days ago
JSON representation
🤔 Strict compare an unsure array against a set of valid values to check if it's legit
- Host: GitHub
- URL: https://github.com/brh55/arr-u-legit
- Owner: brh55
- License: mit
- Created: 2017-06-23T18:45:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-07T15:40:29.000Z (over 7 years ago)
- Last Synced: 2024-11-20T02:36:45.737Z (about 1 month ago)
- Topics: array-helper, comparison, nodejs, strict-comparisons
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# arr-u-legit [![Build Status](https://travis-ci.org/brh55/arr-u-legit.svg?branch=master)](https://travis-ci.org/brh55/arr-u-legit) [![Coverage Status](https://coveralls.io/repos/github/brh55/arr-u-legit/badge.svg?branch=master)](https://coveralls.io/github/brh55/arr-u-legit?branch=master)
> 🤔 Strict compare an unsure array against a set of valid values to check if it's legit
## Install
```
$ npm install --save arr-u-legit
```## Usage
```js
const legit = require('arr-u-legit');legit(['apple', 'banana'], ['apple', 'banana', 'orange']); // => true
legit(['apple', 'banana', 'pineapple'], ['apple', 'banana', 'orange']); // => false// Show Invalid Items
legit(['apple', 'banana', 'chicken'], ['apple', 'banana', 'orange'], true); // => ['chicken']
```## API
### legit(unsureArray, validOptions [, showItems])
#### unsureArray
Type: `array`
The unsure array in question.
#### validOptions
Type: `array`
A set of valid options to compare against.
#### showItems
Type: `bool`
Default: `false`A boolean flag to return the invalid items instead of a boolean result
## License
MIT © [Brandon Him](https://github.com/brh55/arr-u-legit)