constantinople
Advanced tools
Comparing version 2.0.0 to 2.0.1
16
index.js
@@ -39,3 +39,17 @@ 'use strict' | ||
}) | ||
// Walk the AST tree in search for `this` | ||
// Add a fake "this" global when found | ||
var has_this = false; | ||
var walker = new uglify.TreeWalker(function(node) { | ||
if (node instanceof uglify.AST_This) { | ||
has_this = true; | ||
} | ||
}); | ||
ast.walk(walker); | ||
if (has_this) { | ||
globals.push('this') | ||
} | ||
return globals | ||
} | ||
} |
{ | ||
"name": "constantinople", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Determine whether a JavaScript expression evaluates to a constant (using UglifyJS)", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -5,5 +5,5 @@ # constantinople | ||
[![Build Status](https://travis-ci.org/ForbesLindesay/constantinople.png?branch=master)](https://travis-ci.org/ForbesLindesay/constantinople) | ||
[![Dependency Status](https://gemnasium.com/ForbesLindesay/constantinople.png)](https://gemnasium.com/ForbesLindesay/constantinople) | ||
[![NPM version](https://badge.fury.io/js/constantinople.png)](http://badge.fury.io/js/constantinople) | ||
[![Build Status](https://img.shields.io/travis/ForbesLindesay/constantinople/master.svg)](https://travis-ci.org/ForbesLindesay/constantinople) | ||
[![Dependency Status](https://img.shields.io/gemnasium/ForbesLindesay/constantinople.svg)](https://gemnasium.com/ForbesLindesay/constantinople) | ||
[![NPM version](https://img.shields.io/npm/v/constantinople.svg)](http://badge.fury.io/js/constantinople) | ||
@@ -10,0 +10,0 @@ ## Installation |
@@ -25,2 +25,5 @@ 'use strict' | ||
}) | ||
it('handles "this.myVar"', function () { | ||
assert(constaninople.isConstant('this.myVar') === false) | ||
}) | ||
}) | ||
@@ -58,2 +61,2 @@ | ||
}) | ||
}) | ||
}) |
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
7642
103