mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-15 13:17:50 +00:00
Avoid require('vm') if testing AMD.
This commit is contained in:
@@ -35,12 +35,11 @@
|
||||
var last = result[result.length - 1];
|
||||
result = (result.length > min && !/test(?:\.js)?$/.test(last)) ? last : '../lodash.js';
|
||||
|
||||
try {
|
||||
if (!amd) {
|
||||
try {
|
||||
return require('fs').realpathSync(result);
|
||||
}
|
||||
} catch(e) { }
|
||||
|
||||
}
|
||||
return result;
|
||||
}());
|
||||
|
||||
@@ -185,6 +184,7 @@
|
||||
|
||||
// add values from other realms
|
||||
(function() {
|
||||
if (!amd) {
|
||||
try {
|
||||
_.extend(_, require('vm').runInNewContext([
|
||||
'({',
|
||||
@@ -203,7 +203,7 @@
|
||||
'})'
|
||||
].join('\n')));
|
||||
} catch(e) { }
|
||||
|
||||
}
|
||||
if (!_._object && document) {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.frameBorder = iframe.height = iframe.width = 0;
|
||||
|
||||
Reference in New Issue
Block a user