eval2
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -5,3 +5,3 @@ { | ||
"author": "Rich Harris", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "eval2.js", | ||
@@ -8,0 +8,0 @@ "ignore": [ |
61
eval2.js
@@ -1,14 +0,17 @@ | ||
(function ( global ) { | ||
/* | ||
eval2.js - 0.1.2 - 2014-06-01 | ||
============================================================== | ||
Copyright 2014 Rich Harris | ||
Released under the MIT license. | ||
*/ | ||
( function( global ) { | ||
'use strict'; | ||
var _eval, isBrowser, isNode, head, Module, uid = 0; | ||
if ( typeof define === 'function' && define.amd ) { | ||
define( function () { return eval2; }); | ||
} else if ( typeof module !== 'undefined' && module.exports ) { | ||
module.exports = eval2; | ||
} else { | ||
global.eval2 = eval2; | ||
} | ||
var _eval, isBrowser, isNode, head, Module; | ||
@@ -20,3 +23,3 @@ // This causes code to be eval'd in the global scope | ||
isBrowser = true; | ||
head = document.getElementsByTagName( 'head' )[0]; | ||
head = document.getElementsByTagName( 'head' )[ 0 ]; | ||
} else if ( typeof module !== 'undefined' && typeof module.constructor === 'function' ) { | ||
@@ -29,4 +32,6 @@ isNode = true; | ||
function eval2 ( script, options ) { | ||
options = ( typeof options === 'function' ? { callback: options } : options || {} ); | ||
function eval2( script, options ) { | ||
options = ( typeof options === 'function' ? { | ||
callback: options | ||
} : options || {} ); | ||
@@ -55,8 +60,9 @@ if ( options.sourceURL ) { | ||
eval2.Function = function () { | ||
var i, args = [], body, wrapped; | ||
eval2.Function = function() { | ||
var i, args = [], | ||
body, wrapped; | ||
i = arguments.length; | ||
while ( i-- ) { | ||
args[i] = arguments[i]; | ||
args[ i ] = arguments[ i ]; | ||
} | ||
@@ -70,3 +76,3 @@ | ||
function locateErrorUsingDataUri ( code ) { | ||
function locateErrorUsingDataUri( code ) { | ||
var dataURI, scriptElement; | ||
@@ -79,3 +85,3 @@ | ||
scriptElement.onload = function () { | ||
scriptElement.onload = function() { | ||
head.removeChild( scriptElement ); | ||
@@ -87,4 +93,4 @@ }; | ||
function locateErrorUsingModule ( code, url ) { | ||
var m = new Module(), fn; | ||
function locateErrorUsingModule( code, url ) { | ||
var m = new Module(); | ||
@@ -101,2 +107,17 @@ try { | ||
}( typeof window !== 'undefined' ? window : this )); | ||
// export as AMD module... | ||
if ( typeof define === "function" && define.amd ) { | ||
define( function() { | ||
return eval2; | ||
} ); | ||
} | ||
// ...or as Common JS module... | ||
if ( typeof module !== "undefined" && module.exports ) { | ||
module.exports = eval2; | ||
} | ||
// ...or as browser global | ||
global.eval2 = eval2; | ||
}( typeof window !== 'undefined' ? window : this ) ); |
@@ -5,7 +5,13 @@ { | ||
"author": "Rich Harris", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"devDependencies": { | ||
"mocha": "~1.20.0" | ||
"mocha": "~1.20.0", | ||
"grunt": "~0.4.5", | ||
"jit-grunt": "~0.7.0", | ||
"grunt-contrib-concat": "~0.4.0", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-jsbeautifier": "~0.2.7" | ||
}, | ||
"main": "eval2.js" | ||
} |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
377394
55
10334
7
24