fix(core): update

This commit is contained in:
Philipp Kunz 2021-09-12 16:08:20 +02:00
parent f84822dd5d
commit c7557163cd
6 changed files with 18315 additions and 2775 deletions

View File

@ -36,6 +36,7 @@ auditProductionDependencies:
- npmci command npm audit --audit-level=high --only=prod --production - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
allow_failure: true
auditDevDependencies: auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci

20961
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,22 +20,22 @@
}, },
"homepage": "https://gitlab.com/pushrocks/lik#README", "homepage": "https://gitlab.com/pushrocks/lik#README",
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.27",
"@gitzone/tsbundle": "^1.0.78", "@gitzone/tsbundle": "^1.0.87",
"@gitzone/tsrun": "^1.2.12", "@gitzone/tsrun": "^1.2.17",
"@gitzone/tstest": "^1.0.52", "@gitzone/tstest": "^1.0.57",
"@pushrocks/tapbundle": "^3.2.9", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^14.14.9", "@types/node": "^16.9.1",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartmatch": "^1.0.7", "@pushrocks/smartmatch": "^1.0.7",
"@pushrocks/smartpromise": "^3.1.3", "@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.19", "@pushrocks/smartrx": "^2.0.19",
"@pushrocks/smarttime": "^3.0.37", "@pushrocks/smarttime": "^3.0.38",
"@types/minimatch": "^3.0.3", "@types/minimatch": "^3.0.5",
"symbol-tree": "^3.2.4" "symbol-tree": "^3.2.4"
}, },
"files": [ "files": [

28
test/test.fastmap.both.ts Normal file
View 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();

View File

@ -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()) { for (const key of this.getKeys()) {
const item = this.getByKey(key);
const findFunctionResult = await findFunctionArg(item);
if (findFunctionResult) {
return item;
}
} }
} }
} }

View File

@ -62,15 +62,15 @@ export class Tree<T> {
return this.symbolTree.ancestorsToArray(objectArg, optionsArg); return this.symbolTree.ancestorsToArray(objectArg, optionsArg);
} }
treeToArray(rootArg, optionsArg: any): T[] { treeToArray(rootArg: T, optionsArg: any): T[] {
return this.symbolTree.treeToArray(rootArg, optionsArg); return this.symbolTree.treeToArray(rootArg, optionsArg);
} }
childrenIterator(parentArg: T, optionsArg): T { childrenIterator(parentArg: T, optionsArg: any): T {
return this.symbolTree.childrenIterator(parentArg, optionsArg); return this.symbolTree.childrenIterator(parentArg, optionsArg);
} }
previousSiblingsIterator(objectArg): T { previousSiblingsIterator(objectArg: T): T {
return this.symbolTree.previousSiblingsIterator(objectArg); return this.symbolTree.previousSiblingsIterator(objectArg);
} }
@ -78,11 +78,11 @@ export class Tree<T> {
return this.symbolTree.nextSiblingsIterator(); return this.symbolTree.nextSiblingsIterator();
} }
ancestorsIterator(objectArg) { ancestorsIterator(objectArg: T) {
this.symbolTree.ancestorsIterator(); this.symbolTree.ancestorsIterator();
} }
treeIterator(rootArg: T, optionsArg): Iterable<T> { treeIterator(rootArg: T, optionsArg: any): Iterable<T> {
return this.symbolTree.treeIterator(rootArg); return this.symbolTree.treeIterator(rootArg);
} }
@ -114,7 +114,7 @@ export class Tree<T> {
return this.symbolTree.prependChild(referenceObjectArg, newObjectArg); return this.symbolTree.prependChild(referenceObjectArg, newObjectArg);
} }
appendChild(referenceObjectArg, newObjectArg) { appendChild(referenceObjectArg: T, newObjectArg: T) {
return this.symbolTree.appendChild(referenceObjectArg, newObjectArg); return this.symbolTree.appendChild(referenceObjectArg, newObjectArg);
} }
@ -126,7 +126,7 @@ export class Tree<T> {
* returns a branch of the tree as JSON * returns a branch of the tree as JSON
* can be user * can be user
*/ */
toJsonWithHierachy(rootElement) { toJsonWithHierachy(rootElement: T) {
const treeIterable = this.treeIterator(rootElement, {}); const treeIterable = this.treeIterator(rootElement, {});
for (const treeItem of treeIterable) { for (const treeItem of treeIterable) {
console.log(treeItem); console.log(treeItem);
@ -137,5 +137,5 @@ export class Tree<T> {
* builds a tree from a JSON with hierachy * builds a tree from a JSON with hierachy
* @param rootElement * @param rootElement
*/ */
fromJsonWithHierachy(rootElement) {} fromJsonWithHierachy(rootElement: T) {}
} }