From cfffad73eb0cfe377d1c56405cf76aa46fbdeba6 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 13 Nov 2014 23:10:27 -0800 Subject: [PATCH] Make `cloneBuffer` use `_.constant` instead of `_.identity`. --- lodash.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index a4e37d8b0..96c1b777b 100644 --- a/lodash.js +++ b/lodash.js @@ -2667,7 +2667,7 @@ } if (!bufferSlice) { // PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`. - bufferClone = !(ArrayBuffer && Uint8Array) ? identity : function(buffer) { + bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) { var byteLength = buffer.byteLength, floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0, offset = floatLength * FLOAT64_BYTES_PER_ELEMENT, @@ -3244,7 +3244,8 @@ * @private * @param {Object} object The object to clone. * @param {boolean} [isDeep=false] Specify a deep clone. - * @returns {null|Object} Returns the initialized object clone. + * @returns {null|Object} Returns the initialized object clone if an object + * is cloneable, else `null`. */ function initObjectClone(object, isDeep) { if (!isCloneable(object)) {