mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Apply class transform.
This commit is contained in:
4
_Hash.js
4
_Hash.js
@@ -11,7 +11,8 @@ 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 {
|
||||||
|
constructor(entries) {
|
||||||
let index = -1;
|
let index = -1;
|
||||||
const length = entries == null ? 0 : entries.length;
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ function Hash(entries) {
|
|||||||
const entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add methods to `Hash`.
|
// Add methods to `Hash`.
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ 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 {
|
||||||
|
constructor(entries) {
|
||||||
let index = -1;
|
let index = -1;
|
||||||
const length = entries == null ? 0 : entries.length;
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ function ListCache(entries) {
|
|||||||
const entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add methods to `ListCache`.
|
// Add methods to `ListCache`.
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ 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 {
|
||||||
|
constructor(entries) {
|
||||||
let index = -1;
|
let index = -1;
|
||||||
const length = entries == null ? 0 : entries.length;
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ function MapCache(entries) {
|
|||||||
const entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add methods to `MapCache`.
|
// Add methods to `MapCache`.
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ 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 {
|
||||||
|
constructor(values) {
|
||||||
let index = -1;
|
let index = -1;
|
||||||
const length = values == null ? 0 : values.length;
|
const length = values == null ? 0 : values.length;
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ function SetCache(values) {
|
|||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
this.add(values[index]);
|
this.add(values[index]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add methods to `SetCache`.
|
// Add methods to `SetCache`.
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
constructor(entries) {
|
||||||
const data = this.__data__ = new ListCache(entries);
|
const data = this.__data__ = new ListCache(entries);
|
||||||
this.size = data.size;
|
this.size = data.size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add methods to `Stack`.
|
// Add methods to `Stack`.
|
||||||
|
|||||||
Reference in New Issue
Block a user