Compare commits

..

12 Commits

Author SHA1 Message Date
e0eba5d206 4.0.7 2020-05-27 18:15:14 +00:00
d9eb836f98 fix(core): update 2020-05-27 18:15:14 +00:00
6d29798660 4.0.6 2020-05-26 00:06:34 +00:00
f80a84086c fix(core): update 2020-05-26 00:06:34 +00:00
929a6eff07 4.0.5 2020-05-25 22:18:42 +00:00
87243881bb fix(core): update 2020-05-25 22:18:41 +00:00
5d51c14bd6 4.0.4 2020-05-25 22:04:22 +00:00
453c6d6ae8 fix(core): update 2020-05-25 22:04:21 +00:00
2e9fe308df 4.0.3 2020-05-25 18:10:10 +00:00
96a71638a0 fix(core): update 2020-05-25 18:10:10 +00:00
1c7582d328 4.0.2 2020-05-25 15:38:58 +00:00
ccff9b39be fix(core): update 2020-05-25 15:38:57 +00:00
4 changed files with 2081 additions and 611 deletions

2652
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{ {
"name": "@pushrocks/lik", "name": "@pushrocks/lik",
"version": "4.0.1", "version": "4.0.7",
"private": false, "private": false,
"description": "light little helpers for node", "description": "light little helpers for node",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild)" "build": "(tsbuild && tsbundle npm)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -21,6 +21,7 @@
"homepage": "https://gitlab.com/pushrocks/lik#README", "homepage": "https://gitlab.com/pushrocks/lik#README",
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsbundle": "^1.0.69",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.1",
@ -29,13 +30,13 @@
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.6", "@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartmatch": "^1.0.7",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5", "@pushrocks/smartrx": "^2.0.10",
"@pushrocks/smarttime": "^3.0.12", "@pushrocks/smarttime": "^3.0.17",
"@pushrocks/smartunique": "^3.0.3", "@pushrocks/smartunique": "^3.0.3",
"@types/minimatch": "^3.0.3", "@types/minimatch": "^3.0.3",
"minimatch": "^3.0.4",
"symbol-tree": "^3.2.4" "symbol-tree": "^3.2.4"
}, },
"files": [ "files": [

View File

@ -1,26 +1,18 @@
// ==============
// native
// ==============
import * as events from 'events';
export { events };
// ============== // ==============
// @pushrocks // @pushrocks
// ============== // ==============
import * as smartdelay from '@pushrocks/smartdelay'; import * as smartdelay from '@pushrocks/smartdelay';
import * as smartmatch from '@pushrocks/smartmatch';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrx from '@pushrocks/smartrx'; import * as smartrx from '@pushrocks/smartrx';
import * as smarttime from '@pushrocks/smarttime'; import * as smarttime from '@pushrocks/smarttime';
import * as smartunique from '@pushrocks/smartunique'; import * as smartunique from '@pushrocks/smartunique';
export { smartdelay, smartpromise, smartrx, smarttime, smartunique }; export { smartdelay, smartmatch, smartpromise, smartrx, smarttime, smartunique };
// ============== // ==============
// third party // third party
// ============== // ==============
import minimatch from 'minimatch';
const symbolTree = require('symbol-tree'); const symbolTree = require('symbol-tree');
export { minimatch, symbolTree }; export { symbolTree };

View File

@ -4,13 +4,11 @@ import * as plugins from './lik.plugins';
* allows you to easily keep track of a bunch of strings * allows you to easily keep track of a bunch of strings
*/ */
export interface ITriggerFunction { export type TTriggerFunction = (stringArray?: string[]) => boolean;
(): boolean;
}
export class Stringmap { export class Stringmap {
private _stringArray: string[] = []; private _stringArray: string[] = [];
private _triggerUntilTrueFunctionArray: ITriggerFunction[] = []; private _triggerUntilTrueFunctionArray: TTriggerFunction[] = [];
constructor() {} constructor() {}
/** /**
* add a string to the Stringmap * add a string to the Stringmap
@ -60,9 +58,10 @@ export class Stringmap {
* checks stringPresence with minimatch * checks stringPresence with minimatch
*/ */
public checkMinimatch(miniMatchStringArg: string): boolean { public checkMinimatch(miniMatchStringArg: string): boolean {
const smartMatchInstance = new plugins.smartmatch.SmartMatch(miniMatchStringArg);
let foundMatch: boolean = false; let foundMatch: boolean = false;
for (const stringItem of this._stringArray) { for (const stringItem of this._stringArray) {
if (plugins.minimatch(stringItem, miniMatchStringArg)) { if (smartMatchInstance.match(stringItem)) {
foundMatch = true; foundMatch = true;
} }
} }
@ -92,10 +91,10 @@ export class Stringmap {
/** /**
* register a new trigger * register a new trigger
*/ */
public registerUntilTrue(functionArg: ITriggerFunction, callbackArg?: () => any) { public registerUntilTrue(functionArg: TTriggerFunction, callbackArg?: () => any) {
const trueDeferred = plugins.smartpromise.defer(); const trueDeferred = plugins.smartpromise.defer();
this._triggerUntilTrueFunctionArray.push(() => { this._triggerUntilTrueFunctionArray.push(() => {
const result = functionArg(); const result = functionArg(this.getStringArray());
if (result === true) { if (result === true) {
if (callbackArg) { if (callbackArg) {
callbackArg(); callbackArg();