utils-eval v1.0.1
eval
Alias for
evalglobal.
Installation
$ npm install utils-evalUsage
var evil = require( 'utils-eval' );evil( str )
Alias for eval global.
var val = evil( '5*4*3*2*1' );
// returns 120 Notes
- A reference to 
evalis treated differently by the compiler. For example, when evaluating code containing block-scoped declarations (e.g.,let,const,function,class), the compiler may throw anerrorcomplaining that block-scoped declarations are not yet supported outside ofstrict mode. One possible workaround is to include"use strict";in the evaluated code, as done in the example below. 
Examples
var evil = require( 'utils-eval' );
function compile( ctor ) {
	var name;
	var str;
	name = ctor.match( /^(\w*)Array$/ )[ 1 ];
	name = name + 'DataArray';
	str = '';
	str += '(function create(){';
	str += '"use strict";';
	str += 'class '+name+' extends '+ctor+'{';
	str += 'constructor(x){';
	str += 'super(x);';
	str += '}';
	str += '}';
	str += 'return '+name+';';
	str += '})();';
	return str;
}
var ctors = [
	'Int8Array',
	'Uint8Array',
	'Uint8ClampedArray',
	'Int16Array',
	'Uint16Array',
	'Int32Array',
	'Uint32Array',
	'Float32Array',
	'Float64Array',
	'Array'
];
var fcn;
for ( var i = 0; i < ctors.length; i++ ) {
	fcn = evil( compile( ctors[i] ) );
	console.log( fcn.toString() );
}To run the example code from the top-level application directory,
$ node ./examples/index.jsCLI
Installation
To use the module as a general utility, install the module globally
$ npm install -g utils-evalUsage
Usage: jseval [options] code
Options:
  -h,    --help                Print this message.
  -V,    --version             Print the package version.Examples
$ jseval '5*4*3*2*1'
# => 120Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make testAll new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-covIstanbul creates a ./reports/coverage directory. To access an HTML version of the report,
$ make view-covBrowser Support
This repository uses Testling for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:
$ make test-browsersTo view the tests in a local web browser,
$ make view-browser-testsLicense
Copyright
Copyright © 2015. Athan Reines.