babel-plugin-empower-assert
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,9 @@ | ||
## [1.1.0](https://github.com/twada/babel-plugin-empower-assert/releases/tag/v1.1.0) (2016-04-12) | ||
#### Features | ||
* support AssignmentExpression ([61dc73f8](https://github.com/twada/babel-plugin-empower-assert/commit/61dc73f8ffd02e8c8b495be5ca17b6ee2f644af0)) | ||
## [1.0.0](https://github.com/twada/babel-plugin-empower-assert/releases/tag/v1.0.0) (2016-04-12) | ||
@@ -2,0 +10,0 @@ |
23
index.js
@@ -16,2 +16,25 @@ /** | ||
visitor: { | ||
AssignmentExpression: { | ||
enter: function (nodePath, pluginPass) { | ||
if (!nodePath.equals('operator', '=')) { | ||
return; | ||
} | ||
var left = nodePath.get('left'); | ||
if (!left.isIdentifier()) { | ||
return; | ||
} | ||
if (!left.equals('name', 'assert')) { | ||
return; | ||
} | ||
var right = nodePath.get('right'); | ||
if (!right.isCallExpression()) { | ||
return; | ||
} | ||
var callee = right.get('callee'); | ||
var arg = right.get('arguments')[0]; | ||
if (isRequireAssert(callee, arg)) { | ||
arg.set('value', 'power-assert'); | ||
} | ||
} | ||
}, | ||
VariableDeclarator: { | ||
@@ -18,0 +41,0 @@ enter: function (nodePath, pluginPass) { |
{ | ||
"name": "babel-plugin-empower-assert", | ||
"description": "Babel plugin to convert assert to power-assert at compile time", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Takuto Wada", |
[![power-assert][power-assert-banner]][power-assert-url] | ||
[![Build Status][travis-image]][travis-url] | ||
[![NPM version][npm-image]][npm-url] | ||
[![License][license-image]][license-url] | ||
`babel-plugin-empower-assert` is a [Babel](https://babeljs.io/) plugin to convert [assert](https://nodejs.org/api/assert.html) to [power-assert](https://github.com/power-assert-js/power-assert) at compile time. | ||
@@ -123,1 +126,7 @@ | ||
[travis-image]: https://secure.travis-ci.org/twada/babel-plugin-empower-assert.svg?branch=master | ||
[npm-url]: https://npmjs.org/package/babel-plugin-empower-assert | ||
[npm-image]: https://badge.fury.io/js/babel-plugin-empower-assert.svg | ||
[license-url]: http://twada.mit-license.org/ | ||
[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg |
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
6509
66
132