Keep createObject fallback for modern builds.

This commit is contained in:
John-David Dalton
2013-10-02 19:47:15 -07:00
parent d3dd97f167
commit 1f973b72b8
2 changed files with 57 additions and 44 deletions

11
dist/lodash.js vendored
View File

@@ -1332,6 +1332,17 @@
function createObject(prototype) {
return isObject(prototype) ? nativeCreate(prototype) : {};
}
// fallback for browsers without `Object.create`
if (!nativeCreate) {
createObject = function(prototype) {
if (isObject(prototype)) {
noop.prototype = prototype;
var result = new noop;
noop.prototype = null;
}
return result || {};
};
}
/**
* Used by `escape` to convert characters to HTML entities.