remove build files
This commit is contained in:
parent
7927d214d0
commit
e095f79743
3 changed files with 2 additions and 88 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
lib/*
|
||||
|
||||
# ---> Node
|
||||
# Logs
|
||||
logs
|
||||
|
|
14
lib/funkyArray.d.ts
vendored
14
lib/funkyArray.d.ts
vendored
|
@ -1,14 +0,0 @@
|
|||
export default class FunkyArray<T, TT> {
|
||||
private items;
|
||||
private itemKeys;
|
||||
private _getKeys;
|
||||
set(key: T, item: TT, regenerate?: boolean): TT;
|
||||
remove(key: T, regenerate?: boolean): boolean;
|
||||
removeFirst(regenerate?: boolean): boolean;
|
||||
first(): TT;
|
||||
get length(): number;
|
||||
get(key: T): TT | undefined;
|
||||
has(key: T): boolean;
|
||||
get keys(): Array<T>;
|
||||
forEach(callback: (value: TT) => void): Promise<boolean>;
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
"use strict";
|
||||
// Copyright (c) Catgirl Enterprises - Licensed under MIT
|
||||
// Check LICENSE in repository root for more information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class FunkyArray {
|
||||
constructor() {
|
||||
this.items = new Map();
|
||||
this.itemKeys = new Array();
|
||||
}
|
||||
_getKeys() {
|
||||
const keyArray = new Array();
|
||||
let result;
|
||||
const iterator = this.items.keys();
|
||||
while (!(result = iterator.next()).done) {
|
||||
keyArray.push(result.value);
|
||||
}
|
||||
return keyArray;
|
||||
}
|
||||
set(key, item, regenerate = true) {
|
||||
this.items.set(key, item);
|
||||
if (regenerate) {
|
||||
this.itemKeys = this._getKeys();
|
||||
}
|
||||
return item;
|
||||
}
|
||||
remove(key, regenerate = true) {
|
||||
const success = this.items.delete(key);
|
||||
if (regenerate) {
|
||||
this.itemKeys = this._getKeys();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
removeFirst(regenerate = true) {
|
||||
const success = this.items.delete(this.items.keys().next().value);
|
||||
if (regenerate) {
|
||||
this.itemKeys = this._getKeys();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
first() {
|
||||
return this.items.values().next().value;
|
||||
}
|
||||
get length() {
|
||||
return this.items.size;
|
||||
}
|
||||
get(key) {
|
||||
return this.items.get(key);
|
||||
}
|
||||
has(key) {
|
||||
return this.itemKeys.includes(key);
|
||||
}
|
||||
get keys() {
|
||||
return this.itemKeys;
|
||||
}
|
||||
forEach(callback) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (this.items.size === 0) {
|
||||
return resolve(true);
|
||||
}
|
||||
try {
|
||||
const iterator = this.items.values();
|
||||
let result;
|
||||
while (!(result = iterator.next()).done) {
|
||||
await callback(result.value);
|
||||
}
|
||||
resolve(true);
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = FunkyArray;
|
Loading…
Reference in a new issue