babel-plugin-transform-isnil
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -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') { |
{ | ||
"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()', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9489
146