mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Remove unneeded Ctor variables.
This commit is contained in:
28
lodash.js
28
lodash.js
@@ -3792,9 +3792,7 @@
|
|||||||
if (isDeep) {
|
if (isDeep) {
|
||||||
return buffer.slice();
|
return buffer.slice();
|
||||||
}
|
}
|
||||||
var Ctor = buffer.constructor,
|
var result = new buffer.constructor(buffer.length);
|
||||||
result = new Ctor(buffer.length);
|
|
||||||
|
|
||||||
buffer.copy(result);
|
buffer.copy(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3807,11 +3805,8 @@
|
|||||||
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
||||||
*/
|
*/
|
||||||
function cloneArrayBuffer(arrayBuffer) {
|
function cloneArrayBuffer(arrayBuffer) {
|
||||||
var Ctor = arrayBuffer.constructor,
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
||||||
result = new Ctor(arrayBuffer.byteLength),
|
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
||||||
view = new Uint8Array(result);
|
|
||||||
|
|
||||||
view.set(new Uint8Array(arrayBuffer));
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3823,8 +3818,7 @@
|
|||||||
* @returns {Object} Returns the cloned map.
|
* @returns {Object} Returns the cloned map.
|
||||||
*/
|
*/
|
||||||
function cloneMap(map) {
|
function cloneMap(map) {
|
||||||
var Ctor = map.constructor;
|
return arrayReduce(mapToArray(map), addMapEntry, new map.constructor);
|
||||||
return arrayReduce(mapToArray(map), addMapEntry, new Ctor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3835,9 +3829,7 @@
|
|||||||
* @returns {Object} Returns the cloned regexp.
|
* @returns {Object} Returns the cloned regexp.
|
||||||
*/
|
*/
|
||||||
function cloneRegExp(regexp) {
|
function cloneRegExp(regexp) {
|
||||||
var Ctor = regexp.constructor,
|
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
||||||
result = new Ctor(regexp.source, reFlags.exec(regexp));
|
|
||||||
|
|
||||||
result.lastIndex = regexp.lastIndex;
|
result.lastIndex = regexp.lastIndex;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3850,8 +3842,7 @@
|
|||||||
* @returns {Object} Returns the cloned set.
|
* @returns {Object} Returns the cloned set.
|
||||||
*/
|
*/
|
||||||
function cloneSet(set) {
|
function cloneSet(set) {
|
||||||
var Ctor = set.constructor;
|
return arrayReduce(setToArray(set), addSetEntry, new set.constructor);
|
||||||
return arrayReduce(setToArray(set), addSetEntry, new Ctor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3874,11 +3865,8 @@
|
|||||||
* @returns {Object} Returns the cloned typed array.
|
* @returns {Object} Returns the cloned typed array.
|
||||||
*/
|
*/
|
||||||
function cloneTypedArray(typedArray, isDeep) {
|
function cloneTypedArray(typedArray, isDeep) {
|
||||||
var arrayBuffer = typedArray.buffer,
|
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
||||||
buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer,
|
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
||||||
Ctor = typedArray.constructor;
|
|
||||||
|
|
||||||
return new Ctor(buffer, typedArray.byteOffset, typedArray.length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user