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