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

babel-plugin-transform-isnil

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-isnil

replace the comparing of null or undefined with isNil

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-transform-isNil

Installation

$ npm install --save babel-plugin-transform-isnil

Example

In

if (foo.isNil) {
  console.log('foo is null or undefined');
}

Out

if (foo === null || foo === undefined) {
  console.log('foo is null or undefined');
}

In

if (hoge.poge.isNil && foo.bar.isNil) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

Out

if ((hoge.poge === null || hoge.poge === undefined) && (foo.bar === null || foo.bar === undefined)) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

In

if (hoge.poge().isNil) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

Out

if (hoge.poge() === null || hoge.poge() === undefined) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

In

if (hoge.poge(hoge).isNil) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

Out

if (hoge.poge(hoge) === null || hoge.poge(hoge) === undefined) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

TODO

In

if (hoge().poge(hoge).isNil) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

Out

if (hoge().poge(hoge) === null || hoge().poge(hoge) === undefined) {
  console.log('hoge.poge and foo.bar is null or undefined');
}

Usage

Via .babelrc

{
  "plugins": ["babel-plugin-transform-isnil"]
}

Development

Requirement global

  • Node v5.2.0
  • npm v3.7.2
$ git clone https://github.com/MaxMEllon/babel-plugin-transform-isNil
$ cd babel-plugin-transform-isNil
$ npm install

$ npm test

LICENSE

MIT

Keywords

FAQs

Package last updated on 16 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