improve objectmap.forEach to support async actions
This commit is contained in:
parent
6b3fcff971
commit
d2ce1094de
2
dist/lik.objectmap.d.ts
vendored
2
dist/lik.objectmap.d.ts
vendored
@ -38,7 +38,7 @@ export declare class Objectmap<T> {
|
||||
/**
|
||||
* run function for each item in Objectmap
|
||||
*/
|
||||
forEach(functionArg: IObjectmapForEachFunction<T>): void;
|
||||
forEach(functionArg: IObjectmapForEachFunction<T>): Promise<void>;
|
||||
/**
|
||||
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
||||
*/
|
||||
|
16
dist/lik.objectmap.js
vendored
16
dist/lik.objectmap.js
vendored
@ -1,4 +1,12 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./lik.plugins");
|
||||
/**
|
||||
@ -68,7 +76,11 @@ class Objectmap {
|
||||
* run function for each item in Objectmap
|
||||
*/
|
||||
forEach(functionArg) {
|
||||
return this.objectArray.forEach(functionArg);
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
for (let object of this.objectArray) {
|
||||
yield functionArg(object);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
||||
@ -113,4 +125,4 @@ class Objectmap {
|
||||
}
|
||||
}
|
||||
exports.Objectmap = Objectmap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLm9iamVjdG1hcC5qcyIsInNvdX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FBWTtRQUNsQixJQUFJLGdCQUFnQixHQUFHLEVBQUUsQ0FBQTtRQUN6QixHQUFHLENBQUMsQ0FBQyxJQUFJLElBQUksSUFBSSxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQztZQUNsQyxFQUFFLENBQUMsQ0FBQyxJQUFJLEtBQUssU0FBUyxDQUFDLENBQUMsQ0FBQztnQkFDdkIsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFBO1lBQzdCLENBQUM7UUFDSCxDQUFDO1FBQ0QsSUFBSSxDQUFDLFdBQVcsR0FBRyxnQkFBZ0IsQ0FBQTtJQUNyQyxDQUFDO0lBRUQ7O09BRUc7SUFDSCxJQUFJO1FBQ0YsSUFBSSxDQUFDLFdBQVcsR0FBRyxFQUFFLENBQUE7SUFDdkIsQ0FBQztDQUNGO0FBdEhELDhCQXNIQyJ9
|
2
dist/lik.stringmap.js
vendored
2
dist/lik.stringmap.js
vendored
@ -94,4 +94,4 @@ class Stringmap {
|
||||
}
|
||||
}
|
||||
exports.Stringmap = Stringmap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLnN0cmluZ21hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5zdHJpbmdtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBd0M7QUFVeEM7SUFHSTtRQUZRLGlCQUFZLEdBQWEsRUFBRSxDQUFBO1FBQzNCLG1DQUE4QixHQUF1QixFQUFFLENBQUE7SUFDaEQsQ0FBQztJQUNoQjs7T0FFRztJQUNILFNBQVMsQ0FBQyxTQUFpQjtRQUN2QixJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUNqQyxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUE7SUFDeEIsQ0FBQztJQUVEOzt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0FBTyxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFBO0lBQ3BELENBQUM7SUFFRCxzQkFBc0I7SUFFdEI7O09BRUc7SUFDSCxpQkFBaUIsQ0FBRSxXQUE2QixFQUFFLGFBQWE7UUFDN0QsSUFBSSxDQUFDLDhCQUE4QixDQUFDLElBQUksQ0FDdEM7WUFDRSxJQUFJLE1BQU0sR0FBRyxXQUFXLEVBQUUsQ0FBQTtZQUMxQixFQUFFLENBQUMsQ0FBQyxNQUFNLEtBQUssSUFBSSxDQUFDLENBQUMsQ0FBQztnQkFDcEIsYUFBYSxFQUFFLENBQUE7WUFDakIsQ0FBQztZQUNELE1BQU0sQ0FBQyxNQUFNLENBQUE7UUFDZixDQUFDLENBQ0YsQ0FBQTtRQUNELElBQUksQ0FBQyxhQUFhLEVBQUUsQ0FBQTtJQUN0QixDQUFDO0lBRUQ7O09BRUc7SUFDSyxhQUFhO1FBQ25CLElBQUksYUFBYSxHQUFHLElBQUksQ0FBQyw4QkFBOEIsQ0FBQyxNQUFNLENBQUMsQ0FBQyxXQUFXO1lBQ3pFLE1BQU0sQ0FBQyxDQUFDLFdBQVcsRUFBRSxDQUFBO1FBQ3ZCLENBQUMsQ0FBQyxDQUFBO1FBQ0YsSUFBSSxDQUFDLDhCQUE4QixHQUFHLGFBQWEsQ0FBQTtJQUNyRCxDQUFDO0NBRUY7QUF2R0QsOEJBdUdDIn0=
|
@ -5,7 +5,7 @@ import * as rx from 'rxjs/Rx'
|
||||
import * as smartq from 'smartq'
|
||||
|
||||
// import the module
|
||||
import lik = require('../dist/index')
|
||||
import lik = require('../ts/index')
|
||||
|
||||
let object1 = {}
|
||||
let object2 = {}
|
||||
|
@ -5,7 +5,7 @@ import * as rx from 'rxjs/Rx'
|
||||
import * as smartq from 'smartq'
|
||||
|
||||
// import the module
|
||||
import lik = require('../dist/index')
|
||||
import lik = require('../ts/index')
|
||||
|
||||
// Objectmap
|
||||
interface ITestObject {
|
||||
|
@ -5,7 +5,7 @@ import * as rx from 'rxjs/Rx'
|
||||
import * as smartq from 'smartq'
|
||||
|
||||
// import the module
|
||||
import lik = require('../dist/index')
|
||||
import lik = require('../ts/index')
|
||||
|
||||
let testObservablemap: lik.Observablemap
|
||||
let testObservable1: rx.Observable<any>
|
||||
|
@ -5,7 +5,7 @@ import * as rx from 'rxjs/Rx'
|
||||
import * as smartq from 'smartq'
|
||||
|
||||
// import the module
|
||||
import lik = require('../dist/index')
|
||||
import lik = require('../ts/index')
|
||||
|
||||
// testData
|
||||
let testStringmap: lik.Stringmap
|
||||
|
@ -79,8 +79,10 @@ export class Objectmap<T> {
|
||||
/**
|
||||
* run function for each item in Objectmap
|
||||
*/
|
||||
forEach (functionArg: IObjectmapForEachFunction<T>) {
|
||||
return this.objectArray.forEach(functionArg)
|
||||
async forEach (functionArg: IObjectmapForEachFunction<T>) {
|
||||
for (let object of this.objectArray) {
|
||||
await functionArg(object)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,110 +5,110 @@ import * as plugins from './lik.plugins'
|
||||
*/
|
||||
|
||||
export interface ITriggerFunction {
|
||||
(): boolean
|
||||
(): boolean
|
||||
}
|
||||
|
||||
export class Stringmap {
|
||||
private _stringArray: string[] = []
|
||||
private _triggerUntilTrueFunctionArray: ITriggerFunction[] = []
|
||||
constructor() {}
|
||||
/**
|
||||
* add a string to the Stringmap
|
||||
*/
|
||||
addString(stringArg: string) {
|
||||
this._stringArray.push(stringArg)
|
||||
this.notifyTrigger()
|
||||
}
|
||||
private _stringArray: string[] = []
|
||||
private _triggerUntilTrueFunctionArray: ITriggerFunction[] = []
|
||||
constructor() { }
|
||||
/**
|
||||
* add a string to the Stringmap
|
||||
*/
|
||||
addString (stringArg: string) {
|
||||
this._stringArray.push(stringArg)
|
||||
this.notifyTrigger()
|
||||
}
|
||||
|
||||
/**
|
||||
* like addString, but accepts an array of strings
|
||||
*/
|
||||
addStringArray(stringArrayArg: string[]) {
|
||||
for (let stringItem of stringArrayArg){
|
||||
this.addString(stringItem)
|
||||
/**
|
||||
* like addString, but accepts an array of strings
|
||||
*/
|
||||
addStringArray (stringArrayArg: string[]) {
|
||||
for (let stringItem of stringArrayArg) {
|
||||
this.addString(stringItem)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* removes a string from Stringmap
|
||||
*/
|
||||
removeString (stringArg: string) {
|
||||
for (let keyArg in this._stringArray) {
|
||||
if (this._stringArray[ keyArg ] === stringArg) {
|
||||
this._stringArray.splice(parseInt(keyArg), 1)
|
||||
}
|
||||
}
|
||||
this.notifyTrigger()
|
||||
}
|
||||
|
||||
/**
|
||||
* wipes the Stringmap
|
||||
*/
|
||||
wipe () {
|
||||
this._stringArray = []
|
||||
this.notifyTrigger()
|
||||
}
|
||||
|
||||
/**
|
||||
* check if string is in Stringmap
|
||||
*/
|
||||
checkString (stringArg: string): boolean {
|
||||
return this._stringArray.indexOf(stringArg) !== -1
|
||||
}
|
||||
|
||||
/**
|
||||
* checks stringPresence with minimatch
|
||||
*/
|
||||
checkMinimatch (miniMatchStringArg: string): boolean {
|
||||
let foundMatch: boolean = false
|
||||
for (let stringItem of this._stringArray) {
|
||||
if (plugins.minimatch(stringItem, miniMatchStringArg)) {
|
||||
foundMatch = true
|
||||
}
|
||||
}
|
||||
return foundMatch
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if the Stringmap is empty
|
||||
*/
|
||||
checkIsEmpty () {
|
||||
return (this._stringArray.length === 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a cloned copy of the current string Array
|
||||
*/
|
||||
getStringArray () {
|
||||
return plugins.lodash.cloneDeep(this._stringArray)
|
||||
}
|
||||
|
||||
// trigger registering
|
||||
|
||||
/**
|
||||
* register a new trigger
|
||||
*/
|
||||
registerUntilTrue (functionArg: ITriggerFunction, doFunctionArg) {
|
||||
this._triggerUntilTrueFunctionArray.push(
|
||||
() => {
|
||||
let result = functionArg()
|
||||
if (result === true) {
|
||||
doFunctionArg()
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
)
|
||||
this.notifyTrigger()
|
||||
}
|
||||
|
||||
/**
|
||||
* removes a string from Stringmap
|
||||
*/
|
||||
removeString(stringArg: string) {
|
||||
for (let keyArg in this._stringArray) {
|
||||
if (this._stringArray[keyArg] === stringArg) {
|
||||
this._stringArray.splice(parseInt(keyArg),1)
|
||||
}
|
||||
}
|
||||
this.notifyTrigger()
|
||||
}
|
||||
|
||||
/**
|
||||
* wipes the Stringmap
|
||||
*/
|
||||
wipe() {
|
||||
this._stringArray = []
|
||||
this.notifyTrigger()
|
||||
}
|
||||
|
||||
/**
|
||||
* check if string is in Stringmap
|
||||
*/
|
||||
checkString(stringArg: string): boolean {
|
||||
return this._stringArray.indexOf(stringArg) !== -1
|
||||
}
|
||||
|
||||
/**
|
||||
* checks stringPresence with minimatch
|
||||
*/
|
||||
checkMinimatch(miniMatchStringArg: string): boolean {
|
||||
let foundMatch: boolean = false
|
||||
for (let stringItem of this._stringArray){
|
||||
if (plugins.minimatch(stringItem,miniMatchStringArg)) {
|
||||
foundMatch = true
|
||||
}
|
||||
}
|
||||
return foundMatch
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if the Stringmap is empty
|
||||
*/
|
||||
checkIsEmpty() {
|
||||
return (this._stringArray.length === 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a cloned copy of the current string Array
|
||||
*/
|
||||
getStringArray() {
|
||||
return plugins.lodash.cloneDeep(this._stringArray)
|
||||
}
|
||||
|
||||
// trigger registering
|
||||
|
||||
/**
|
||||
* register a new trigger
|
||||
*/
|
||||
registerUntilTrue(functionArg: ITriggerFunction,doFunctionArg) {
|
||||
this._triggerUntilTrueFunctionArray.push(
|
||||
() => {
|
||||
let result = functionArg()
|
||||
if (result === true) {
|
||||
doFunctionArg()
|
||||
}
|
||||
return result
|
||||
}
|
||||
)
|
||||
this.notifyTrigger()
|
||||
}
|
||||
|
||||
/**
|
||||
* notifies triggers
|
||||
*/
|
||||
private notifyTrigger() {
|
||||
let filteredArray = this._triggerUntilTrueFunctionArray.filter((functionArg) => {
|
||||
return !functionArg()
|
||||
})
|
||||
this._triggerUntilTrueFunctionArray = filteredArray
|
||||
}
|
||||
/**
|
||||
* notifies triggers
|
||||
*/
|
||||
private notifyTrigger () {
|
||||
let filteredArray = this._triggerUntilTrueFunctionArray.filter((functionArg) => {
|
||||
return !functionArg()
|
||||
})
|
||||
this._triggerUntilTrueFunctionArray = filteredArray
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user