From 746034a4fc54f39d2664400e4d1c8c34d19bd2cc Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 7 Jun 2015 13:51:06 -0700 Subject: [PATCH] Simplified `bufferClone`. --- lodash.src.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 1bfdb52e6..0fb6bc29f 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -748,7 +748,7 @@ ); /** Native method references. */ - var ArrayBuffer = getNative(context, 'ArrayBuffer'), + var ArrayBuffer = context.ArrayBuffer, ceil = Math.ceil, clearTimeout = context.clearTimeout, floor = Math.floor, @@ -757,7 +757,7 @@ Set = getNative(context, 'Set'), setTimeout = context.setTimeout, splice = arrayProto.splice, - Uint8Array = getNative(context, 'Uint8Array'), + Uint8Array = context.Uint8Array, WeakMap = getNative(context, 'WeakMap'); /* Native method references for those with the same name as other `lodash` methods. */ @@ -799,7 +799,7 @@ ctorByTag[int8Tag] = context.Int8Array; ctorByTag[int16Tag] = context.Int16Array; ctorByTag[int32Tag] = context.Int32Array; - ctorByTag[uint8Tag] = context.Uint8Array; + ctorByTag[uint8Tag] = Uint8Array; ctorByTag[uint8ClampedTag] = context.Uint8ClampedArray; ctorByTag[uint16Tag] = context.Uint16Array; ctorByTag[uint32Tag] = context.Uint32Array; @@ -3001,13 +3001,13 @@ * @param {ArrayBuffer} buffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ - var bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) { + function bufferClone(buffer) { var result = new ArrayBuffer(buffer.byteLength), view = new Uint8Array(result); view.set(new Uint8Array(buffer)); return result; - }; + } /** * Creates an array that is the composition of partially applied arguments,