Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/admit
JavaScript array admit/ban/check utility module
https://github.com/ryanve/admit
array javascript module utility
Last synced: 25 days ago
JSON representation
JavaScript array admit/ban/check utility module
- Host: GitHub
- URL: https://github.com/ryanve/admit
- Owner: ryanve
- License: mit
- Created: 2016-09-01T04:56:35.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-09T06:38:06.000Z (about 8 years ago)
- Last Synced: 2024-10-04T20:05:51.564Z (about 1 month ago)
- Topics: array, javascript, module, utility
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/admit
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# admit
```sh
npm install admit --save
```### Features
- admit values into arrays
- ban values from arrays
- test if arrays contains values## Usage
```js
var admit = require('admit')admit([0, 1, 2], 2) // [0, 1, 2]
admit([0, 1, 2], 3) // [0, 1, 2, 3]
admit.has([0, 1, 2], 1) // true
admit.has([0, 1, 2], 3) // false
admit.ban([0, 0, 2], 0) // [2]
admit.is(1, 1) // true
admit.is(1, 2) // false
admit.use(Object.is) // cloned admit api that uses Object.is
```## API
- stack can be an array or array-like object
- value can be any type### admit(stack, value)
Add value into stack if stack doesn't already contain value*Alias:* `admit.admit(stack, value)`
### admit.has(stack, value)
Test if stack contains value### admit.ban(stack, value)
Remove all instances of value from stack### admit.is(a, b)
Simple default `===` comparison### admit.use(is)
Create a new version of admit that uses a different is function#### Example
```js
var admit = require('admit')
var equal = require('deep-equal')
admit = admit.use(equal)
```## License
MIT