mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Apply class transform.
This commit is contained in:
16
_Hash.js
16
_Hash.js
@@ -11,14 +11,16 @@ import hashSet from './_hashSet.js';
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
*/
|
*/
|
||||||
function Hash(entries) {
|
class Hash {
|
||||||
let index = -1;
|
constructor(entries) {
|
||||||
const length = entries == null ? 0 : entries.length;
|
let index = -1;
|
||||||
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
const entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,16 @@ import listCacheSet from './_listCacheSet.js';
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
*/
|
*/
|
||||||
function ListCache(entries) {
|
class ListCache {
|
||||||
let index = -1;
|
constructor(entries) {
|
||||||
const length = entries == null ? 0 : entries.length;
|
let index = -1;
|
||||||
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
const entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
_MapCache.js
16
_MapCache.js
@@ -11,14 +11,16 @@ import mapCacheSet from './_mapCacheSet.js';
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
*/
|
*/
|
||||||
function MapCache(entries) {
|
class MapCache {
|
||||||
let index = -1;
|
constructor(entries) {
|
||||||
const length = entries == null ? 0 : entries.length;
|
let index = -1;
|
||||||
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
const entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
_SetCache.js
14
_SetCache.js
@@ -10,13 +10,15 @@ import setCacheHas from './_setCacheHas.js';
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {Array} [values] The values to cache.
|
* @param {Array} [values] The values to cache.
|
||||||
*/
|
*/
|
||||||
function SetCache(values) {
|
class SetCache {
|
||||||
let index = -1;
|
constructor(values) {
|
||||||
const length = values == null ? 0 : values.length;
|
let index = -1;
|
||||||
|
const length = values == null ? 0 : values.length;
|
||||||
|
|
||||||
this.__data__ = new MapCache;
|
this.__data__ = new MapCache;
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
this.add(values[index]);
|
this.add(values[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ import stackSet from './_stackSet.js';
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {Array} [entries] The key-value pairs to cache.
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
*/
|
*/
|
||||||
function Stack(entries) {
|
class Stack {
|
||||||
const data = this.__data__ = new ListCache(entries);
|
constructor(entries) {
|
||||||
this.size = data.size;
|
const data = this.__data__ = new ListCache(entries);
|
||||||
|
this.size = data.size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add methods to `Stack`.
|
// Add methods to `Stack`.
|
||||||
|
|||||||
Reference in New Issue
Block a user