babel-plugin-extract-string
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "babel-plugin-extract-string", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Babel plugin to extract string from js source file then save into array", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -21,3 +21,3 @@ var fs = require('fs') | ||
var str = path.node.value | ||
if(!name || str.trim()=='use strict') return | ||
if(!name || !str || str.trim()=='use strict') return | ||
var index = addToSet(arr, str) | ||
@@ -24,0 +24,0 @@ path.replaceWith(t.memberExpression(t.identifier(name), t.numericLiteral(index), true)) |
@@ -25,2 +25,7 @@ import { transform } from 'babel-core' | ||
// empty strings | ||
var a = transform(`var d ='dd'; b=''; c='dd';`, babelTranslationOptions({name: 'abc'})) | ||
assert.equal(a.code, `var d = abc[0];b = '';c = abc[0];`) | ||
assert.deepEqual(a.metadata._store, [ 'dd' ]) | ||
// don't touch ObjectProperty | ||
@@ -27,0 +32,0 @@ var a = transform(`var d = {'aaa': 123};`, babelTranslationOptions({name: 'abc'})) |
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
4674
75
8