mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Remove semicolons.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
import Hash from './Hash.js';
|
||||
import ListCache from './ListCache.js';
|
||||
import Hash from './Hash.js'
|
||||
import ListCache from './ListCache.js'
|
||||
|
||||
/**
|
||||
* Gets the data for `map`.
|
||||
@@ -11,10 +11,10 @@ import ListCache from './ListCache.js';
|
||||
* @returns {*} Returns the map data.
|
||||
*/
|
||||
function getMapData({ __data__ }, key) {
|
||||
const data = __data__;
|
||||
const data = __data__
|
||||
return isKeyable(key)
|
||||
? data[typeof key == 'string' ? 'string' : 'hash']
|
||||
: data.map;
|
||||
: data.map
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,10 +25,10 @@ function getMapData({ __data__ }, key) {
|
||||
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
||||
*/
|
||||
function isKeyable(value) {
|
||||
const type = typeof value;
|
||||
const type = typeof value
|
||||
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
||||
? (value !== '__proto__')
|
||||
: (value === null);
|
||||
: (value === null)
|
||||
}
|
||||
|
||||
class MapCache {
|
||||
@@ -41,13 +41,13 @@ class MapCache {
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
constructor(entries) {
|
||||
let index = -1;
|
||||
const length = entries == null ? 0 : entries.length;
|
||||
let index = -1
|
||||
const length = entries == null ? 0 : entries.length
|
||||
|
||||
this.clear();
|
||||
this.clear()
|
||||
while (++index < length) {
|
||||
const entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
const entry = entries[index]
|
||||
this.set(entry[0], entry[1])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ class MapCache {
|
||||
* @memberOf MapCache
|
||||
*/
|
||||
clear() {
|
||||
this.size = 0;
|
||||
this.size = 0
|
||||
this.__data__ = {
|
||||
'hash': new Hash,
|
||||
'map': new (Map || ListCache),
|
||||
'string': new Hash
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,9 +73,9 @@ class MapCache {
|
||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||
*/
|
||||
delete(key) {
|
||||
const result = getMapData(this, key)['delete'](key);
|
||||
this.size -= result ? 1 : 0;
|
||||
return result;
|
||||
const result = getMapData(this, key)['delete'](key)
|
||||
this.size -= result ? 1 : 0
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ class MapCache {
|
||||
* @returns {*} Returns the entry value.
|
||||
*/
|
||||
get(key) {
|
||||
return getMapData(this, key).get(key);
|
||||
return getMapData(this, key).get(key)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ class MapCache {
|
||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||
*/
|
||||
has(key) {
|
||||
return getMapData(this, key).has(key);
|
||||
return getMapData(this, key).has(key)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,13 +109,13 @@ class MapCache {
|
||||
* @returns {Object} Returns the map cache instance.
|
||||
*/
|
||||
set(key, value) {
|
||||
const data = getMapData(this, key);
|
||||
const size = data.size;
|
||||
const data = getMapData(this, key)
|
||||
const size = data.size
|
||||
|
||||
data.set(key, value);
|
||||
this.size += data.size == size ? 0 : 1;
|
||||
return this;
|
||||
data.set(key, value)
|
||||
this.size += data.size == size ? 0 : 1
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
export default MapCache;
|
||||
export default MapCache
|
||||
|
||||
Reference in New Issue
Block a user