Socket
Socket
Sign inDemoInstall

obj-denied

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    obj-denied

Check if the required properties are set, the easy way!


Version published
Maintainers
1
Install size
37.4 kB
Created

Readme

Source

obj-denied

Check if the required properties are set, the easy way!

Build Status Dependency Status NSP Status

Requirements

To use this module, the following is required:

  • An env that accepts ES6' const and let

Installation

You can install this module with NPM:

npm install --save obj-denied

Usage

Require the library
    const denied = require('obj-denied');
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(denied(obj, ['foo', 'baz'])) {
        return 'Not all required props are given';
    }

    // Go on with life

Oops!

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

    // Nothing going on here, debug the part above, because denied returned true

Keywords

FAQs

Last updated on 13 Jun 2017

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