mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Apply more let/const transforms.
This commit is contained in:
31
_getTag.js
31
_getTag.js
@@ -7,20 +7,19 @@ import baseGetTag from './_baseGetTag.js';
|
||||
import toSource from './_toSource.js';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
objectTag = '[object Object]',
|
||||
promiseTag = '[object Promise]',
|
||||
setTag = '[object Set]',
|
||||
weakMapTag = '[object WeakMap]';
|
||||
|
||||
var dataViewTag = '[object DataView]';
|
||||
const dataViewTag = '[object DataView]';
|
||||
const mapTag = '[object Map]';
|
||||
const objectTag = '[object Object]';
|
||||
const promiseTag = '[object Promise]';
|
||||
const setTag = '[object Set]';
|
||||
const weakMapTag = '[object WeakMap]';
|
||||
|
||||
/** Used to detect maps, sets, and weakmaps. */
|
||||
var dataViewCtorString = toSource(DataView),
|
||||
mapCtorString = toSource(Map),
|
||||
promiseCtorString = toSource(Promise),
|
||||
setCtorString = toSource(Set),
|
||||
weakMapCtorString = toSource(WeakMap);
|
||||
const dataViewCtorString = toSource(DataView);
|
||||
const mapCtorString = toSource(Map);
|
||||
const promiseCtorString = toSource(Promise);
|
||||
const setCtorString = toSource(Set);
|
||||
const weakMapCtorString = toSource(WeakMap);
|
||||
|
||||
/**
|
||||
* Gets the `toStringTag` of `value`.
|
||||
@@ -29,7 +28,7 @@ var dataViewCtorString = toSource(DataView),
|
||||
* @param {*} value The value to query.
|
||||
* @returns {string} Returns the `toStringTag`.
|
||||
*/
|
||||
var getTag = baseGetTag;
|
||||
let getTag = baseGetTag;
|
||||
|
||||
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
||||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||
@@ -38,9 +37,9 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||
(Set && getTag(new Set) != setTag) ||
|
||||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
||||
getTag = value => {
|
||||
var result = baseGetTag(value),
|
||||
Ctor = result == objectTag ? value.constructor : undefined,
|
||||
ctorString = Ctor ? toSource(Ctor) : '';
|
||||
const result = baseGetTag(value);
|
||||
const Ctor = result == objectTag ? value.constructor : undefined;
|
||||
const ctorString = Ctor ? toSource(Ctor) : '';
|
||||
|
||||
if (ctorString) {
|
||||
switch (ctorString) {
|
||||
|
||||
Reference in New Issue
Block a user