lodash._createwrapper
Advanced tools
Comparing version 3.1.0 to 3.1.1
63
index.js
/** | ||
* lodash 3.1.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.1.1 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
@@ -52,6 +52,38 @@ * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
/** Built-in method references without a dependency on `global`. */ | ||
/** Used to determine if values are of the language type `Object`. */ | ||
var objectTypes = { | ||
'function': true, | ||
'object': true | ||
}; | ||
/** Built-in method references without a dependency on `root`. */ | ||
var freeParseInt = parseInt; | ||
/** Detect free variable `exports`. */ | ||
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; | ||
/** Detect free variable `module`. */ | ||
var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; | ||
/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); | ||
/** Detect free variable `self`. */ | ||
var freeSelf = checkGlobal(objectTypes[typeof self] && self); | ||
/** Detect free variable `window`. */ | ||
var freeWindow = checkGlobal(objectTypes[typeof window] && window); | ||
/** Detect `this` as the global object. */ | ||
var thisGlobal = checkGlobal(objectTypes[typeof this] && this); | ||
/** | ||
* Used as a reference to the global object. | ||
* | ||
* The `this` value is used if it's the global object to avoid Greasemonkey's | ||
* restricted `window` object, otherwise the `window` object is used. | ||
*/ | ||
var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); | ||
/** | ||
* A faster alternative to `Function#apply`, this function invokes `func` | ||
@@ -63,7 +95,7 @@ * with the `this` binding of `thisArg` and the arguments of `args`. | ||
* @param {*} thisArg The `this` binding of `func`. | ||
* @param {...*} [args] The arguments to invoke `func` with. | ||
* @param {...*} args The arguments to invoke `func` with. | ||
* @returns {*} Returns the result of `func`. | ||
*/ | ||
function apply(func, thisArg, args) { | ||
var length = args ? args.length : 0; | ||
var length = args.length; | ||
switch (length) { | ||
@@ -79,2 +111,13 @@ case 0: return func.call(thisArg); | ||
/** | ||
* Checks if `value` is a global object. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {null|Object} Returns `value` if it's a global object, else `null`. | ||
*/ | ||
function checkGlobal(value) { | ||
return (value && value.Object === Object) ? value : null; | ||
} | ||
/** | ||
* Checks if `value` is a valid array-like index. | ||
@@ -118,3 +161,3 @@ * | ||
/** Used for built-in method references. */ | ||
var objectProto = global.Object.prototype; | ||
var objectProto = Object.prototype; | ||
@@ -247,3 +290,3 @@ /** | ||
function wrapper() { | ||
var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; | ||
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; | ||
return fn.apply(isBind ? thisArg : this, arguments); | ||
@@ -303,3 +346,3 @@ } | ||
args = Array(length), | ||
fn = (this && this !== global && this instanceof wrapper) ? Ctor : func, | ||
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, | ||
placeholder = wrapper.placeholder; | ||
@@ -382,3 +425,3 @@ | ||
} | ||
if (this && this !== global && this instanceof wrapper) { | ||
if (this && this !== root && this instanceof wrapper) { | ||
fn = Ctor || createCtorWrapper(fn); | ||
@@ -413,3 +456,3 @@ } | ||
args = Array(leftLength + argsLength), | ||
fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; | ||
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; | ||
@@ -604,4 +647,2 @@ while (++leftIndex < leftLength) { | ||
function isObject(value) { | ||
// Avoid a V8 JIT bug in Chrome 19-20. | ||
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
var type = typeof value; | ||
@@ -608,0 +649,0 @@ return !!value && (type == 'object' || type == 'function'); |
{ | ||
"name": "lodash._createwrapper", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "The internal lodash function `createWrapper` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash._createwrapper v3.1.0 | ||
# lodash._createwrapper v3.1.1 | ||
@@ -18,2 +18,2 @@ The internal [lodash](https://lodash.com/) function `createWrapper` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash._createwrapper) for more details. | ||
See the [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash._createwrapper) for more details. |
25619
651
271028