Socket
Socket
Sign inDemoInstall

admit

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    admit

admit/ban/check for array values like a proper bouncer


Version published
Weekly downloads
1
Maintainers
1
Install size
4.86 kB
Created
Weekly downloads
 

Readme

Source

admit

npm install admit --save

Features

  • admit values into arrays
  • ban values from arrays
  • test if arrays contains values

Usage

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
var admit = require('admit')
var equal = require('deep-equal')
admit = admit.use(equal)

License

MIT

Keywords

FAQs

Last updated on 01 Sep 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc