fix(core): update

This commit is contained in:
Philipp Kunz 2020-02-06 11:11:16 +00:00
parent e1442b1bc8
commit 596a897afc
10 changed files with 174 additions and 117 deletions

View File

@ -1,18 +1,16 @@
# gitzone ci_default # gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
variables:
GIT_STRATEGY: clone
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
# ==================== # ====================
# security stage # security stage
@ -20,21 +18,23 @@ stages:
mirror: mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
snyk: snyk:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command snyk test
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
# ==================== # ====================
# test stage # test stage
@ -43,37 +43,40 @@ snyk:
testStable: testStable:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - lossless
- priv - docker
- priv
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci node install lts - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
# ==================== # ====================
# metadata stage # metadata stage
@ -83,33 +86,35 @@ codequality:
allow_failure: true allow_failure: true
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- docker - lossless
- priv - docker
- priv
trigger: trigger:
stage: metadata stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata stage: metadata
script: script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command tsdoc
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:
@ -117,5 +122,5 @@ pages:
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - public
allow_failure: true allow_failure: true

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

27
.vscode/settings.json vendored
View File

@ -1,3 +1,26 @@
{ {
"workbench.colorCustomizations": {} "json.schemas": [
} {
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
}
}
}
}
}
}
]
}

View File

@ -1,43 +0,0 @@
# @pushrocks/lik
light little helpers for node
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/lik)
* [gitlab.com (source)](https://gitlab.com/pushrocks/lik)
* [github.com (source mirror)](https://github.com/pushrocks/lik)
* [docs (typedoc)](https://pushrocks.gitlab.io/lik/)
## Status for master
[![build status](https://gitlab.com/pushrocks/lik/badges/master/build.svg)](https://gitlab.com/pushrocks/lik/commits/master)
[![coverage report](https://gitlab.com/pushrocks/lik/badges/master/coverage.svg)](https://gitlab.com/pushrocks/lik/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/lik.svg)](https://www.npmjs.com/package/@pushrocks/lik)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/lik/badge.svg)](https://snyk.io/test/npm/@pushrocks/lik)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
Use TypeScript for best in class instellisense.
```javascript
// import any tool that you need from lik
import { Stringmap, Objectmap, Observablemap } from 'lik';
```
### class Stringmap
Stringmap allows you to keep track of strings. It allows you to register triggers for certain events
like when a certain string is removed or added to the map
### class Objectmap
Sometimes you need to keep track of objects, but implementing logic for removing, finding or updating is tedious.
Objectmap takes care of keeping track of objects for you.
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -4,6 +4,7 @@
"npmAccessLevel": "public" "npmAccessLevel": "public"
}, },
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",

42
package-lock.json generated
View File

@ -11,18 +11,18 @@
"dev": true "dev": true
}, },
"@babel/code-frame": { "@babel/code-frame": {
"version": "7.5.5", "version": "7.8.3",
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz", "resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.8.3.tgz",
"integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/highlight": "^7.0.0" "@babel/highlight": "^7.8.3"
} }
}, },
"@babel/highlight": { "@babel/highlight": {
"version": "7.5.0", "version": "7.8.3",
"resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.5.0.tgz", "resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.8.3.tgz",
"integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.0.0", "chalk": "^2.0.0",
@ -536,9 +536,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
}, },
"@types/node": { "@types/node": {
"version": "12.12.14", "version": "13.7.0",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.12.14.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.0.tgz",
"integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==" "integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ=="
}, },
"@types/through2": { "@types/through2": {
"version": "2.0.34", "version": "2.0.34",
@ -1482,9 +1482,9 @@
"dev": true "dev": true
}, },
"resolve": { "resolve": {
"version": "1.13.1", "version": "1.15.1",
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.13.1.tgz", "resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.15.1.tgz",
"integrity": "sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==", "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
"dev": true, "dev": true,
"requires": { "requires": {
"path-parse": "^1.0.6" "path-parse": "^1.0.6"
@ -1688,9 +1688,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
}, },
"tslint": { "tslint": {
"version": "5.20.1", "version": "6.0.0",
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.1.tgz", "resolved": "https://verdaccio.lossless.one/tslint/-/tslint-6.0.0.tgz",
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "integrity": "sha512-9nLya8GBtlFmmFMW7oXXwoXS1NkrccqTqAtwXzdPV9e2mqSEvCki6iHL/Fbzi5oqbugshzgGPk7KBb2qNP1DSA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.0.0", "@babel/code-frame": "^7.0.0",
@ -1704,8 +1704,16 @@
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"resolve": "^1.3.2", "resolve": "^1.3.2",
"semver": "^5.3.0", "semver": "^5.3.0",
"tslib": "^1.8.0", "tslib": "^1.10.0",
"tsutils": "^2.29.0" "tsutils": "^2.29.0"
},
"dependencies": {
"tslib": {
"version": "1.10.0",
"resolved": "https://verdaccio.lossless.one/tslib/-/tslib-1.10.0.tgz",
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
"dev": true
}
} }
}, },
"tslint-config-prettier": { "tslint-config-prettier": {

View File

@ -24,8 +24,8 @@
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.2.0", "@pushrocks/tapbundle": "^3.2.0",
"@types/node": "^12.12.14", "@types/node": "^13.7.0",
"tslint": "^5.20.1", "tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
@ -38,14 +38,14 @@
"symbol-tree": "^3.2.4" "symbol-tree": "^3.2.4"
}, },
"files": [ "files": [
"ts/*", "ts/**/*",
"ts_web/*", "ts_web/**/*",
"dist/*", "dist/**/*",
"dist_web/*", "dist_web/**/*",
"dist_ts_web/*", "dist_ts_web/**/*",
"assets/*", "assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
] ]
} }

11
ts/lik.fastmap.ts Normal file
View File

@ -0,0 +1,11 @@
import * as plugins from './lik.plugins';
export class FastMap<T> {
private mapObject: { [key: string]: T } = {};
public isUniqueKey() {}
public addToMap(identifier: string, objectArg: T) {
this.mapObject[identifier] = objectArg;
}
}

View File

@ -1,4 +1,5 @@
import * as plugins from './lik.plugins'; import * as plugins from './lik.plugins';
import { FastMap } from './lik.fastmap';
export interface IObjectmapForEachFunction<T> { export interface IObjectmapForEachFunction<T> {
(itemArg: T): void; (itemArg: T): void;
@ -12,6 +13,7 @@ export interface IObjectmapFindFunction<T> {
* allows keeping track of objects * allows keeping track of objects
*/ */
export class Objectmap<T> { export class Objectmap<T> {
private fastMap = new FastMap<T>();
private objectArray: T[] = []; private objectArray: T[] = [];
// events // events
@ -24,6 +26,27 @@ export class Objectmap<T> {
// nothing here // nothing here
} }
/**
* adds an object mapped to a string
* the string must be unique
*/
addMappedUnique(uniqueKey: string, objectArg: T) {
this.add(objectArg);
this.fastMap.addToMap(uniqueKey, objectArg);
}
/**
* fastest way to get an object from the map
* @param uniqueKey
*/
public getMappedUnique(uniqueKey: string) {}
/**
* remove key
* @param functionArg
*/
public removeMappedUnique() {}
/** /**
* add object to Objectmap * add object to Objectmap
* returns false if the object is already in the map * returns false if the object is already in the map

View File

@ -24,7 +24,7 @@ export class Stringmap {
* like addString, but accepts an array of strings * like addString, but accepts an array of strings
*/ */
addStringArray(stringArrayArg: string[]) { addStringArray(stringArrayArg: string[]) {
for (let stringItem of stringArrayArg) { for (const stringItem of stringArrayArg) {
this.addString(stringItem); this.addString(stringItem);
} }
} }
@ -33,7 +33,7 @@ export class Stringmap {
* removes a string from Stringmap * removes a string from Stringmap
*/ */
removeString(stringArg: string) { removeString(stringArg: string) {
for (let keyArg in this._stringArray) { for (const keyArg in this._stringArray) {
if (this._stringArray[keyArg] === stringArg) { if (this._stringArray[keyArg] === stringArg) {
this._stringArray.splice(parseInt(keyArg), 1); this._stringArray.splice(parseInt(keyArg), 1);
} }
@ -61,7 +61,7 @@ export class Stringmap {
*/ */
public checkMinimatch(miniMatchStringArg: string): boolean { public checkMinimatch(miniMatchStringArg: string): boolean {
let foundMatch: boolean = false; let foundMatch: boolean = false;
for (let stringItem of this._stringArray) { for (const stringItem of this._stringArray) {
if (plugins.minimatch(stringItem, miniMatchStringArg)) { if (plugins.minimatch(stringItem, miniMatchStringArg)) {
foundMatch = true; foundMatch = true;
} }
@ -94,7 +94,7 @@ export class Stringmap {
*/ */
public registerUntilTrue(functionArg: ITriggerFunction, doFunctionArg) { public registerUntilTrue(functionArg: ITriggerFunction, doFunctionArg) {
this._triggerUntilTrueFunctionArray.push(() => { this._triggerUntilTrueFunctionArray.push(() => {
let result = functionArg(); const result = functionArg();
if (result === true) { if (result === true) {
doFunctionArg(); doFunctionArg();
} }
@ -107,7 +107,7 @@ export class Stringmap {
* notifies triggers * notifies triggers
*/ */
private notifyTrigger() { private notifyTrigger() {
let filteredArray = this._triggerUntilTrueFunctionArray.filter(functionArg => { const filteredArray = this._triggerUntilTrueFunctionArray.filter(functionArg => {
return !functionArg(); return !functionArg();
}); });
this._triggerUntilTrueFunctionArray = filteredArray; this._triggerUntilTrueFunctionArray = filteredArray;