Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

epk-nil

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epk-nil

My hate isn't undefined.

  • 0.0.2
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

✌️ Nil

Build Status jest

No more cannot read property x of undefined wih a simple ~200bytes script!

💻 Installation

$ yarn add epk-nil

or

$ npm install epk-nil --save

then inport it as a module

ES6

import Nil from 'epk-nil'

ES5

const Nil = require('epk-nil')

👌 Usage

import Nil from 'epk-nil'

const myObject = {
  user: {
    name: 'John',
    surname: 'Doe',
    birthday: '1995-01-29',
    contacts: {
      email: 'foo@bar.com',
      phone: '000 0000000'
    },
    languages: ['english', 'italian']
  }
}

const a = Nil(myObject, 'user.name')    // => John
const b = Nil(myObject, 'languages[1]') // => italian
const c = Nil(myObject, 'foo.bar.baz')  // => false

if (a) {
  console.log(a) // => John
}

if (b) {
  console.log(b) // => italian
}

if (c) {
  console.log(c) // => won't log anything!
}

⚖️ License

MIT

FAQs

Package last updated on 05 Jul 2018

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