fix(core): update
This commit is contained in:
parent
f84822dd5d
commit
c7557163cd
@ -36,6 +36,7 @@ auditProductionDependencies:
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
20961
package-lock.json
generated
20961
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@ -20,22 +20,22 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/lik#README",
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tsbundle": "^1.0.78",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@gitzone/tstest": "^1.0.52",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.14.9",
|
||||
"@gitzone/tsbuild": "^2.1.27",
|
||||
"@gitzone/tsbundle": "^1.0.87",
|
||||
"@gitzone/tsrun": "^1.2.17",
|
||||
"@gitzone/tstest": "^1.0.57",
|
||||
"@pushrocks/tapbundle": "^3.2.14",
|
||||
"@types/node": "^16.9.1",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
"@pushrocks/smartmatch": "^1.0.7",
|
||||
"@pushrocks/smartpromise": "^3.1.3",
|
||||
"@pushrocks/smartpromise": "^3.1.6",
|
||||
"@pushrocks/smartrx": "^2.0.19",
|
||||
"@pushrocks/smarttime": "^3.0.37",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@pushrocks/smarttime": "^3.0.38",
|
||||
"@types/minimatch": "^3.0.5",
|
||||
"symbol-tree": "^3.2.4"
|
||||
},
|
||||
"files": [
|
||||
|
28
test/test.fastmap.both.ts
Normal file
28
test/test.fastmap.both.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
|
||||
import * as lik from '../ts';
|
||||
|
||||
tap.test('should create a valid fastmap', async () => {
|
||||
const fastmap = new lik.FastMap();
|
||||
expect(fastmap).to.be.instanceOf(lik.FastMap);
|
||||
});
|
||||
|
||||
tap.test('should find an entry', async () => {
|
||||
const fastmap = new lik.FastMap<{
|
||||
value1: string;
|
||||
value2: string;
|
||||
}>();
|
||||
fastmap.addToMap('heythere', {
|
||||
value1: 'heyho',
|
||||
value2: 'heyho2'
|
||||
})
|
||||
fastmap.addToMap('heythere2', {
|
||||
value1: 'heyho3',
|
||||
value2: 'heyho4'
|
||||
});
|
||||
|
||||
const result = await fastmap.find(async (itemArg)=> {return itemArg.value2 === 'heyho4'});
|
||||
expect(result.value1).to.equal('heyho3');
|
||||
});
|
||||
|
||||
tap.start();
|
@ -80,9 +80,13 @@ export class FastMap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public async find(findFunction: (mapItemArg: T) => Promise<boolean>) {
|
||||
public async find(findFunctionArg: (mapItemArg: T) => Promise<boolean>) {
|
||||
for (const key of this.getKeys()) {
|
||||
|
||||
const item = this.getByKey(key);
|
||||
const findFunctionResult = await findFunctionArg(item);
|
||||
if (findFunctionResult) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,15 +62,15 @@ export class Tree<T> {
|
||||
return this.symbolTree.ancestorsToArray(objectArg, optionsArg);
|
||||
}
|
||||
|
||||
treeToArray(rootArg, optionsArg: any): T[] {
|
||||
treeToArray(rootArg: T, optionsArg: any): T[] {
|
||||
return this.symbolTree.treeToArray(rootArg, optionsArg);
|
||||
}
|
||||
|
||||
childrenIterator(parentArg: T, optionsArg): T {
|
||||
childrenIterator(parentArg: T, optionsArg: any): T {
|
||||
return this.symbolTree.childrenIterator(parentArg, optionsArg);
|
||||
}
|
||||
|
||||
previousSiblingsIterator(objectArg): T {
|
||||
previousSiblingsIterator(objectArg: T): T {
|
||||
return this.symbolTree.previousSiblingsIterator(objectArg);
|
||||
}
|
||||
|
||||
@ -78,11 +78,11 @@ export class Tree<T> {
|
||||
return this.symbolTree.nextSiblingsIterator();
|
||||
}
|
||||
|
||||
ancestorsIterator(objectArg) {
|
||||
ancestorsIterator(objectArg: T) {
|
||||
this.symbolTree.ancestorsIterator();
|
||||
}
|
||||
|
||||
treeIterator(rootArg: T, optionsArg): Iterable<T> {
|
||||
treeIterator(rootArg: T, optionsArg: any): Iterable<T> {
|
||||
return this.symbolTree.treeIterator(rootArg);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ export class Tree<T> {
|
||||
return this.symbolTree.prependChild(referenceObjectArg, newObjectArg);
|
||||
}
|
||||
|
||||
appendChild(referenceObjectArg, newObjectArg) {
|
||||
appendChild(referenceObjectArg: T, newObjectArg: T) {
|
||||
return this.symbolTree.appendChild(referenceObjectArg, newObjectArg);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ export class Tree<T> {
|
||||
* returns a branch of the tree as JSON
|
||||
* can be user
|
||||
*/
|
||||
toJsonWithHierachy(rootElement) {
|
||||
toJsonWithHierachy(rootElement: T) {
|
||||
const treeIterable = this.treeIterator(rootElement, {});
|
||||
for (const treeItem of treeIterable) {
|
||||
console.log(treeItem);
|
||||
@ -137,5 +137,5 @@ export class Tree<T> {
|
||||
* builds a tree from a JSON with hierachy
|
||||
* @param rootElement
|
||||
*/
|
||||
fromJsonWithHierachy(rootElement) {}
|
||||
fromJsonWithHierachy(rootElement: T) {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user