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 - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

5

lib/index.js

@@ -20,2 +20,7 @@ 'use strict';

Object.keys(object).forEach(function (key) {
if (/.type$/.test(key)) {
if (object[key] === 'ThisExpression') {
name += 'this.';
}
}
if (/.name$/.test(key)) {

@@ -22,0 +27,0 @@ if (!/arguments/.test(key) && object[key] !== 'isNil') {

2

package.json
{
"name": "babel-plugin-transform-isnil",
"version": "0.0.2",
"version": "0.0.3",
"description": "replace the comparing of null or undefined with isNil",

@@ -5,0 +5,0 @@ "main": "lib",

@@ -15,2 +15,7 @@ import flatten from 'flat'

Object.keys(object).forEach(key => {
if (/.type$/.test(key)) {
if (object[key] === 'ThisExpression') {
name += 'this.'
}
}
if (/.name$/.test(key)) {

@@ -17,0 +22,0 @@ if (!/arguments/.test(key) && object[key] !== 'isNil') {

@@ -22,2 +22,12 @@ import test from 'ava-spec'

{
description: 'expect ! isNil replace to `! (=== null || === undefined)`',
before: '!hoge.isNil',
after: '"use strict";\n\n!(hoge === null || hoge === undefined);'
},
{
description: 'expect isNil replace to `=== null || === undefined`',
before: 'class Hoge { constructor(hoge) { if (this.hoge.isNil) { this.hoge = hoge; } } }',
after: '"use strict";\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nvar Hoge = function Hoge(hoge) {\n _classCallCheck(this, Hoge);\n\n if (this.hoge === null || this.hoge === undefined) {\n this.hoge = hoge;\n }\n};'
},
{
description: 'expect isNil() dont replace',

@@ -24,0 +34,0 @@ before: 'R.isNil()',

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