New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

accepted

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accepted

Small module that checks if the given object has given properties and are not null or undefined

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Accepted

Small module that checks if the given object has given properties and are not null or undefined

Requirements

To use this module, one the following is required:

  • Node.js v6.0.0 or higher
  • An env that accepts ES6' const and let

Installation

You can install this module with NPM:

npm install --save accepted

Usage

Require the library
    const accepted = require('accepted');
Define an Object (or get one)
    const obj = {
        foo: 'bar',
        baz: 'qux',
        nope: null,
        sub_obj: {exists: 'Yes!'},
        sub_arr: ['element']
    }
Start checking!

Success!

    if(!accepted(obj, ['foo', 'baz'])) {
        return 'Not all required props are given';
    }

    // Go on with life

Oops!

    if(!accepted(obj, ['nope', 'non-existend'])) {
        return 'Not all required props are given';
    }

    // Life stopped, accepted returned false
``

Keywords

FAQs

Package last updated on 28 May 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc