Compare commits
62 Commits
Author | SHA1 | Date | |
---|---|---|---|
52b65d7dc3 | |||
1135b418cb | |||
2eb1dbd0b3 | |||
8ec54c17a1 | |||
500a291b2a | |||
256a14fcb0 | |||
7aa0f05bae | |||
6208cab36a | |||
50a9697baf | |||
7956cf6ace | |||
d8956d4e32 | |||
c93a67c351 | |||
fafd9867ad | |||
2dfa96bbc5 | |||
a7484e791a | |||
2dba68df8c | |||
6aff4c9031 | |||
e81e0ebd41 | |||
18866b9a05 | |||
71b12b2d9c | |||
0669fc3779 | |||
7021f8f1ae | |||
2392915959 | |||
b8100f8dfc | |||
04e9d8be77 | |||
a9715381c1 | |||
c2f081d69a | |||
b98f075cbd | |||
5ff74aea88 | |||
a6eaf78c80 | |||
adda1c932a | |||
7c8643b090 | |||
9e81960095 | |||
a76832bedb | |||
3c229e8e26 | |||
29d6f2d7e0 | |||
2b5ff6a4ab | |||
c75437e73f | |||
61e4a62689 | |||
d53f5410cd | |||
53516b1c8f | |||
e59205490b | |||
38884ff59c | |||
861833e930 | |||
1274840d17 | |||
d2ce1094de | |||
6b3fcff971 | |||
011a865271 | |||
78914e54b3 | |||
281cfdc38a | |||
217252de1e | |||
ab7f7230ef | |||
7f03ae5248 | |||
0060ec2971 | |||
eec89a596a | |||
d34a91d283 | |||
db14306bcf | |||
cf446f90ee | |||
9c2f3cf678 | |||
18df32ae5a | |||
66b6e78bb1 | |||
408faa97a4 |
25
.gitignore
vendored
25
.gitignore
vendored
@ -1,5 +1,22 @@
|
|||||||
node_modules/
|
.nogit/
|
||||||
pages/
|
|
||||||
public/
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
.nogit/
|
public/
|
||||||
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_web/
|
||||||
|
dist_serve/
|
||||||
|
dist_ts_web/
|
||||||
|
|
||||||
|
# custom
|
104
.gitlab-ci.yml
104
.gitlab-ci.yml
@ -1,71 +1,119 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- .yarn/
|
- .npmci_cache/
|
||||||
key: "$CI_BUILD_STAGE"
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- trigger
|
- metadata
|
||||||
- pages
|
|
||||||
|
|
||||||
testLEGACY:
|
# ====================
|
||||||
stage: test
|
# security stage
|
||||||
|
# ====================
|
||||||
|
mirror:
|
||||||
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci git mirror
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
- notpriv
|
||||||
|
|
||||||
|
snyk:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install -g snyk
|
||||||
|
- npmci command npm install --ignore-scripts
|
||||||
|
- npmci command snyk test
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# test stage
|
||||||
|
# ====================
|
||||||
|
|
||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci npm prepare
|
||||||
|
- npmci node install lts
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
testSTABLE:
|
|
||||||
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci npm prepare
|
||||||
|
- npmci node install lts
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci publish
|
- npmci node install lts
|
||||||
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# metadata stage
|
||||||
|
# ====================
|
||||||
|
codequality:
|
||||||
|
stage: metadata
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- npmci command npm install -g tslint typescript
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: trigger
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-dbase:npmci
|
||||||
stage: pages
|
services:
|
||||||
|
- docker:18-dind
|
||||||
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command yarn global add npmpage
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
- npmci command npmpage --publish gitlab
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command tsdoc
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"workbench.colorCustomizations": {}
|
||||||
|
}
|
43
README.md
43
README.md
@ -1,48 +1,43 @@
|
|||||||
# lik
|
# @pushrocks/lik
|
||||||
light little helpers for node
|
light little helpers for node
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty and Links
|
||||||
[](https://www.npmjs.com/package/lik)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/lik)
|
||||||
[](https://GitLab.com/pushrocks/lik)
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/lik)
|
||||||
[](https://github.com/pushrocks/lik)
|
* [github.com (source mirror)](https://github.com/pushrocks/lik)
|
||||||
[](https://pushrocks.gitlab.io/lik/)
|
* [docs (typedoc)](https://pushrocks.gitlab.io/lik/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://GitLab.com/pushrocks/lik/commits/master)
|
[](https://gitlab.com/pushrocks/lik/commits/master)
|
||||||
[](https://GitLab.com/pushrocks/lik/commits/master)
|
[](https://gitlab.com/pushrocks/lik/commits/master)
|
||||||
[](https://www.npmjs.com/package/lik)
|
[](https://www.npmjs.com/package/@pushrocks/lik)
|
||||||
[](https://david-dm.org/pushrocks/lik)
|
[](https://snyk.io/test/npm/@pushrocks/lik)
|
||||||
[](https://www.bithound.io/github/pushrocks/lik/master/dependencies/npm)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://www.bithound.io/github/pushrocks/lik)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
[](https://prettier.io/)
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// import any tool that you need from lik
|
// import any tool that you need from lik
|
||||||
import { Stringmap, Objectmap, Observablemap } from "lik";
|
import { Stringmap, Objectmap, Observablemap } from 'lik';
|
||||||
```
|
```
|
||||||
|
|
||||||
### class Stringmap
|
### class Stringmap
|
||||||
|
|
||||||
Stringmap allows you to keep track of strings. It allows you to register triggers for certain events
|
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
|
like when a certain string is removed or added to the map
|
||||||
|
|
||||||
### class Objectmap
|
### class Objectmap
|
||||||
|
|
||||||
Sometimes you need to keep track of objects, but implementing logic for removing, finding or updating is tedious.
|
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.
|
Objectmap takes care of keeping track of objects for you.
|
||||||
|
|
||||||
### class Observablemap
|
For further information read the linked docs at the top of this readme.
|
||||||
Event Emitters are nice. However often times you end up with registering multiple listeners for the exact same thing.
|
|
||||||
Observables have a smaller footprint and a more manageable subscribe logic.
|
|
||||||
Observablemap registers only one rxjs observable per event and then continues to reference
|
|
||||||
the same observable that you can subscribe to.
|
|
||||||
|
|
||||||
For further information read the linked docs at the top of this README.
|
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
[](https://push.rocks)
|
[](https://maintainedby.lossless.com)
|
||||||
|
3
dist/index.d.ts
vendored
3
dist/index.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
export * from './lik.stringmap';
|
|
||||||
export * from './lik.objectmap';
|
|
||||||
export * from './lik.observablemap';
|
|
10
dist/index.js
vendored
10
dist/index.js
vendored
@ -1,10 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
function __export(m) {
|
|
||||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
||||||
}
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
// import modules
|
|
||||||
__export(require("./lik.stringmap"));
|
|
||||||
__export(require("./lik.objectmap"));
|
|
||||||
__export(require("./lik.observablemap"));
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUVBLGlCQUFpQjtBQUVqQixxQ0FBK0I7QUFDL0IscUNBQStCO0FBQy9CLHlDQUFtQyJ9
|
|
60
dist/lik.objectmap.d.ts
vendored
60
dist/lik.objectmap.d.ts
vendored
@ -1,60 +0,0 @@
|
|||||||
export interface IObjectmapForEachFunction<T> {
|
|
||||||
(itemArg: T): void;
|
|
||||||
}
|
|
||||||
export interface IObjectmapFindFunction<T> {
|
|
||||||
(itemArg: T): boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* allows keeping track of objects
|
|
||||||
*/
|
|
||||||
export declare class Objectmap<T> {
|
|
||||||
private objectArray;
|
|
||||||
/**
|
|
||||||
* returns a new instance
|
|
||||||
*/
|
|
||||||
constructor();
|
|
||||||
/**
|
|
||||||
* add object to Objectmap
|
|
||||||
*/
|
|
||||||
add(objectArg: T): void;
|
|
||||||
/**
|
|
||||||
* like .add but adds an whole array of objects
|
|
||||||
*/
|
|
||||||
addArray(objectArrayArg: T[]): void;
|
|
||||||
/**
|
|
||||||
* check if object is in Objectmap
|
|
||||||
*/
|
|
||||||
checkForObject(objectArg: T): boolean;
|
|
||||||
/**
|
|
||||||
* find object
|
|
||||||
*/
|
|
||||||
find(findFunction: IObjectmapFindFunction<T>): T;
|
|
||||||
/**
|
|
||||||
* finds a specific element and then removes it
|
|
||||||
*/
|
|
||||||
findOneAndRemove(findFunction: any): T;
|
|
||||||
/**
|
|
||||||
* run function for each item in Objectmap
|
|
||||||
*/
|
|
||||||
forEach(functionArg: IObjectmapForEachFunction<T>): void;
|
|
||||||
/**
|
|
||||||
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
|
||||||
*/
|
|
||||||
getOneAndRemove(): T;
|
|
||||||
/**
|
|
||||||
* returns a cloned array of all the objects currently in the Objectmap
|
|
||||||
*/
|
|
||||||
getArray(): T[];
|
|
||||||
/**
|
|
||||||
* check if Objectmap ist empty
|
|
||||||
*/
|
|
||||||
isEmpty(): boolean;
|
|
||||||
/**
|
|
||||||
* remove object from Objectmap
|
|
||||||
*/
|
|
||||||
remove(objectArg: T): void;
|
|
||||||
/**
|
|
||||||
* wipe Objectmap
|
|
||||||
*/
|
|
||||||
wipe(): void;
|
|
||||||
}
|
|
105
dist/lik.objectmap.js
vendored
105
dist/lik.objectmap.js
vendored
@ -1,105 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const plugins = require("./lik.plugins");
|
|
||||||
/**
|
|
||||||
* allows keeping track of objects
|
|
||||||
*/
|
|
||||||
class Objectmap {
|
|
||||||
/**
|
|
||||||
* returns a new instance
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
this.objectArray = [];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* add object to Objectmap
|
|
||||||
*/
|
|
||||||
add(objectArg) {
|
|
||||||
this.objectArray.push(objectArg);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* like .add but adds an whole array of objects
|
|
||||||
*/
|
|
||||||
addArray(objectArrayArg) {
|
|
||||||
for (let item of objectArrayArg) {
|
|
||||||
this.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* check if object is in Objectmap
|
|
||||||
*/
|
|
||||||
checkForObject(objectArg) {
|
|
||||||
return this.objectArray.indexOf(objectArg) !== -1;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* find object
|
|
||||||
*/
|
|
||||||
find(findFunction) {
|
|
||||||
let resultArray = this.objectArray.filter(findFunction);
|
|
||||||
if (resultArray.length > 0) {
|
|
||||||
return resultArray[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* finds a specific element and then removes it
|
|
||||||
*/
|
|
||||||
findOneAndRemove(findFunction) {
|
|
||||||
let foundElement = this.find(findFunction);
|
|
||||||
if (foundElement) {
|
|
||||||
this.remove(foundElement);
|
|
||||||
}
|
|
||||||
return foundElement;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* run function for each item in Objectmap
|
|
||||||
*/
|
|
||||||
forEach(functionArg) {
|
|
||||||
return this.objectArray.forEach(functionArg);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
|
||||||
*/
|
|
||||||
getOneAndRemove() {
|
|
||||||
return this.objectArray.shift();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* returns a cloned array of all the objects currently in the Objectmap
|
|
||||||
*/
|
|
||||||
getArray() {
|
|
||||||
return plugins.lodash.cloneDeep(this.objectArray);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* check if Objectmap ist empty
|
|
||||||
*/
|
|
||||||
isEmpty() {
|
|
||||||
if (this.objectArray.length === 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* remove object from Objectmap
|
|
||||||
*/
|
|
||||||
remove(objectArg) {
|
|
||||||
let replacementArray = [];
|
|
||||||
for (let item of this.objectArray) {
|
|
||||||
if (item !== objectArg) {
|
|
||||||
replacementArray.push(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.objectArray = replacementArray;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* wipe Objectmap
|
|
||||||
*/
|
|
||||||
wipe() {
|
|
||||||
this.objectArray = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Objectmap = Objectmap;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLm9iamVjdG1hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5vYmplY3RtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBd0M7QUFVeEM7O0dBRUc7QUFDSDtJQUdJOztPQUVHO0lBQ0g7UUFMUSxnQkFBVyxHQUFRLEVBQUUsQ0FBQTtJQU83QixDQUFDO0lBRUQ7O09BRUc7SUFDSCxHQUFHLENBQUMsU0FBWTtRQUNaLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQ3BDLENBQUM7SUFFRDs7T0FFRztJQUNILFFBQVEsQ0FBQyxjQUFtQjtRQUN4QixHQUFHLENBQUMsQ0FBQyxJQUFJLElBQUksSUFBSSxjQUFjLENBQUMsQ0FBQyxDQUFDO1lBQzlCLElBQUksQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDbEIsQ0FBQztJQUNMLENBQUM7SUFFRDs7T0FFRztJQUNILGNBQWMsQ0FBQyxTQUFZO1FBQ3ZCLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQTtJQUNyRCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxJQUFJLENBQUMsWUFBdUM7UUFDeEMsSUFBSSxXQUFXLEdBQUcsSUFBSSxDQUFDLFdBQVcsQ0FBQyxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDdkQsRUFBRSxDQUFDLENBQUMsV0FBVyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3pCLE1BQU0sQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDekIsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ0osTUFBTSxDQUFDLElBQUksQ0FBQTtRQUNmLENBQUM7SUFDTCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxnQkFBZ0IsQ0FBQyxZQUFZO1FBQ3pCLElBQUksWUFBWSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDMUMsRUFBRSxDQUFDLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUNmLElBQUksQ0FBQyxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDN0IsQ0FBQztRQUNELE1BQU0sQ0FBQyxZQUFZLENBQUE7SUFDdkIsQ0FBQztJQUVEOztPQUVHO0lBQ0gsT0FBTyxDQUFDLFdBQXlDO1FBQzdDLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQTtJQUNoRCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxlQUFlO1FBQ1gsTUFBTSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsS0FBSyxFQUFFLENBQUE7SUFDbkMsQ0FBQztJQUVEOztPQUVHO0lBQ0gsUUFBUTtRQUNKLE1BQU0sQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDckQsQ0FBQztJQUVEOztPQUVHO0lBQ0gsT0FBTztRQUNILEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsTUFBTSxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDaEMsTUFBTSxDQUFDLElBQUksQ0FBQTtRQUNmLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNKLE1BQU0sQ0FBQyxLQUFLLENBQUE7UUFDaEIsQ0FBQztJQUNMLENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU0sQ0FBQyxTQUFZO1FBQ2YsSUFBSSxnQkFBZ0IsR0FBRyxFQUFFLENBQUE7UUFDekIsR0FBRyxDQUFDLENBQUMsSUFBSSxJQUFJLElBQUksSUFBSSxDQUFDLFdBQVcsQ0FBQyxDQUFDLENBQUM7WUFDaEMsRUFBRSxDQUFDLENBQUMsSUFBSSxLQUFLLFNBQVMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3JCLGdCQUFnQixDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtZQUMvQixDQUFDO1FBQ0wsQ0FBQztRQUNELElBQUksQ0FBQyxXQUFXLEdBQUcsZ0JBQWdCLENBQUE7SUFDdkMsQ0FBQztJQUVEOztPQUVHO0lBQ0gsSUFBSTtRQUNBLElBQUksQ0FBQyxXQUFXLEdBQUcsRUFBRSxDQUFBO0lBQ3pCLENBQUM7Q0FDSjtBQTNHRCw4QkEyR0MifQ==
|
|
22
dist/lik.observablemap.d.ts
vendored
22
dist/lik.observablemap.d.ts
vendored
@ -1,22 +0,0 @@
|
|||||||
import * as plugins from './lik.plugins';
|
|
||||||
import { Objectmap } from './lik.objectmap';
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
|
||||||
/**
|
|
||||||
* bundles an observable with an emitter
|
|
||||||
*/
|
|
||||||
export interface ObservableEmitterBundle {
|
|
||||||
observable: plugins.rx.Observable<any>;
|
|
||||||
emitter: plugins.events.EventEmitter;
|
|
||||||
event: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* manages observables by making sure that only one observable is regsitered per event
|
|
||||||
*/
|
|
||||||
export declare class Observablemap {
|
|
||||||
ObservableEmitterBundleObjectmap: Objectmap<ObservableEmitterBundle>;
|
|
||||||
/**
|
|
||||||
* creates a new observable if not yet registered for the same event.
|
|
||||||
* In case event has been registered before the same observable is returned.
|
|
||||||
*/
|
|
||||||
getObservableForEmitterEvent(emitterArg: plugins.events.EventEmitter, eventArg: string): Observable<any>;
|
|
||||||
}
|
|
35
dist/lik.observablemap.js
vendored
35
dist/lik.observablemap.js
vendored
@ -1,35 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const plugins = require("./lik.plugins");
|
|
||||||
const lik_objectmap_1 = require("./lik.objectmap");
|
|
||||||
/**
|
|
||||||
* manages observables by making sure that only one observable is regsitered per event
|
|
||||||
*/
|
|
||||||
class Observablemap {
|
|
||||||
constructor() {
|
|
||||||
this.ObservableEmitterBundleObjectmap = new lik_objectmap_1.Objectmap();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* creates a new observable if not yet registered for the same event.
|
|
||||||
* In case event has been registered before the same observable is returned.
|
|
||||||
*/
|
|
||||||
getObservableForEmitterEvent(emitterArg, eventArg) {
|
|
||||||
let existingBundle = this.ObservableEmitterBundleObjectmap.find((bundleArg) => {
|
|
||||||
return (bundleArg.emitter === emitterArg && bundleArg.event === eventArg);
|
|
||||||
});
|
|
||||||
if (existingBundle) {
|
|
||||||
return existingBundle.observable;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let emitterObservable = plugins.rx.Observable.fromEvent(emitterArg, eventArg);
|
|
||||||
this.ObservableEmitterBundleObjectmap.add({
|
|
||||||
observable: emitterObservable,
|
|
||||||
emitter: emitterArg,
|
|
||||||
event: eventArg
|
|
||||||
});
|
|
||||||
return emitterObservable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Observablemap = Observablemap;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLm9ic2VydmFibGVtYXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9saWsub2JzZXJ2YWJsZW1hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUF3QztBQUN4QyxtREFBMkM7QUFjM0M7O0dBRUc7QUFDSDtJQUFBO1FBQ0kscUNBQWdDLEdBQUcsSUFBSSx5QkFBUyxFQUEyQixDQUFBO0lBc0IvRSxDQUFDO0lBcEJHOzs7T0FHRztJQUNILDRCQUE0QixDQUFDLFVBQXVDLEVBQUUsUUFBZ0I7UUFDbEYsSUFBSSxjQUFjLEdBQUcsSUFBSSxDQUFDLGdDQUFnQyxDQUFDLElBQUksQ0FBQyxDQUFDLFNBQVM7WUFDdEUsTUFBTSxDQUFBLENBQUMsU0FBUyxDQUFDLE9BQU8sS0FBSyxVQUFVLElBQUksU0FBUyxDQUFDLEtBQUssS0FBSyxRQUFRLENBQUMsQ0FBQTtRQUM1RSxDQUFDLENBQUMsQ0FBQTtRQUNGLEVBQUUsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7WUFDakIsTUFBTSxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUE7UUFDcEMsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ0osSUFBSSxpQkFBaUIsR0FBRyxPQUFPLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsVUFBVSxFQUFFLFFBQVEsQ0FBQyxDQUFBO1lBQzdFLElBQUksQ0FBQyxnQ0FBZ0MsQ0FBQyxHQUFHLENBQUM7Z0JBQ3RDLFVBQVUsRUFBRSxpQkFBaUI7Z0JBQzdCLE9BQU8sRUFBRSxVQUFVO2dCQUNuQixLQUFLLEVBQUUsUUFBUTthQUNsQixDQUFDLENBQUE7WUFDRixNQUFNLENBQUMsaUJBQWlCLENBQUE7UUFDNUIsQ0FBQztJQUNMLENBQUM7Q0FDSjtBQXZCRCxzQ0F1QkMifQ==
|
|
6
dist/lik.plugins.d.ts
vendored
6
dist/lik.plugins.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
import 'typings-global';
|
|
||||||
export import q = require('q');
|
|
||||||
export import events = require('events');
|
|
||||||
export import lodash = require('lodash');
|
|
||||||
export import minimatch = require('minimatch');
|
|
||||||
export import rx = require('rxjs/Rx');
|
|
9
dist/lik.plugins.js
vendored
9
dist/lik.plugins.js
vendored
@ -1,9 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
require("typings-global");
|
|
||||||
exports.q = require("q");
|
|
||||||
exports.events = require("events");
|
|
||||||
exports.lodash = require("lodash");
|
|
||||||
exports.minimatch = require("minimatch");
|
|
||||||
exports.rx = require("rxjs/Rx");
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9saWsucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix5QkFBOEI7QUFDOUIsbUNBQXdDO0FBQ3hDLG1DQUF3QztBQUN4Qyx5Q0FBOEM7QUFDOUMsZ0NBQXFDIn0=
|
|
51
dist/lik.stringmap.d.ts
vendored
51
dist/lik.stringmap.d.ts
vendored
@ -1,51 +0,0 @@
|
|||||||
/**
|
|
||||||
* allows you to easily keep track of a bunch of strings
|
|
||||||
*/
|
|
||||||
export interface ITriggerFunction {
|
|
||||||
(): boolean;
|
|
||||||
}
|
|
||||||
export declare class Stringmap {
|
|
||||||
private _stringArray;
|
|
||||||
private _triggerUntilTrueFunctionArray;
|
|
||||||
constructor();
|
|
||||||
/**
|
|
||||||
* add a string to the Stringmap
|
|
||||||
*/
|
|
||||||
addString(stringArg: string): void;
|
|
||||||
/**
|
|
||||||
* like addString, but accepts an array of strings
|
|
||||||
*/
|
|
||||||
addStringArray(stringArrayArg: string[]): void;
|
|
||||||
/**
|
|
||||||
* removes a string from Stringmap
|
|
||||||
*/
|
|
||||||
removeString(stringArg: string): void;
|
|
||||||
/**
|
|
||||||
* wipes the Stringmap
|
|
||||||
*/
|
|
||||||
wipe(): void;
|
|
||||||
/**
|
|
||||||
* check if string is in Stringmap
|
|
||||||
*/
|
|
||||||
checkString(stringArg: string): boolean;
|
|
||||||
/**
|
|
||||||
* checks stringPresence with minimatch
|
|
||||||
*/
|
|
||||||
checkMinimatch(miniMatchStringArg: string): boolean;
|
|
||||||
/**
|
|
||||||
* checks if the Stringmap is empty
|
|
||||||
*/
|
|
||||||
checkIsEmpty(): boolean;
|
|
||||||
/**
|
|
||||||
* gets a cloned copy of the current string Array
|
|
||||||
*/
|
|
||||||
getStringArray(): string[];
|
|
||||||
/**
|
|
||||||
* register a new trigger
|
|
||||||
*/
|
|
||||||
registerUntilTrue(functionArg: ITriggerFunction, doFunctionArg: any): void;
|
|
||||||
/**
|
|
||||||
* notifies triggers
|
|
||||||
*/
|
|
||||||
private notifyTrigger();
|
|
||||||
}
|
|
97
dist/lik.stringmap.js
vendored
97
dist/lik.stringmap.js
vendored
@ -1,97 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const plugins = require("./lik.plugins");
|
|
||||||
class Stringmap {
|
|
||||||
constructor() {
|
|
||||||
this._stringArray = [];
|
|
||||||
this._triggerUntilTrueFunctionArray = [];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* add a string to the Stringmap
|
|
||||||
*/
|
|
||||||
addString(stringArg) {
|
|
||||||
this._stringArray.push(stringArg);
|
|
||||||
this.notifyTrigger();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* like addString, but accepts an array of strings
|
|
||||||
*/
|
|
||||||
addStringArray(stringArrayArg) {
|
|
||||||
for (let stringItem of stringArrayArg) {
|
|
||||||
this.addString(stringItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* removes a string from Stringmap
|
|
||||||
*/
|
|
||||||
removeString(stringArg) {
|
|
||||||
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) {
|
|
||||||
return this._stringArray.indexOf(stringArg) !== -1;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* checks stringPresence with minimatch
|
|
||||||
*/
|
|
||||||
checkMinimatch(miniMatchStringArg) {
|
|
||||||
let foundMatch = 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, doFunctionArg) {
|
|
||||||
this._triggerUntilTrueFunctionArray.push(() => {
|
|
||||||
let result = functionArg();
|
|
||||||
if (result === true) {
|
|
||||||
doFunctionArg();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
this.notifyTrigger();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* notifies triggers
|
|
||||||
*/
|
|
||||||
notifyTrigger() {
|
|
||||||
let filteredArray = this._triggerUntilTrueFunctionArray.filter((functionArg) => {
|
|
||||||
return !functionArg();
|
|
||||||
});
|
|
||||||
this._triggerUntilTrueFunctionArray = filteredArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Stringmap = Stringmap;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLnN0cmluZ21hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5zdHJpbmdtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBd0M7QUFVeEM7SUFHSTtRQUZRLGlCQUFZLEdBQWEsRUFBRSxDQUFBO1FBQzNCLG1DQUE4QixHQUF1QixFQUFFLENBQUE7SUFDaEQsQ0FBQztJQUNoQjs7T0FFRztJQUNILFNBQVMsQ0FBQyxTQUFpQjtRQUN2QixJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUNqQyxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUE7SUFDeEIsQ0FBQztJQUVEOztPQUVHO0lBQ0gsY0FBYyxDQUFDLGNBQXdCO1FBQ25DLEdBQUcsQ0FBQyxDQUFDLElBQUksVUFBVSxJQUFJLGNBQWMsQ0FBQyxDQUFBLENBQUM7WUFDbkMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxVQUFVLENBQUMsQ0FBQTtRQUM5QixDQUFDO0lBQ0wsQ0FBQztJQUVEOztPQUVHO0lBQ0gsWUFBWSxDQUFDLFNBQWlCO1FBQzFCLEdBQUcsQ0FBQyxDQUFDLElBQUksTUFBTSxJQUFJLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDO1lBQ25DLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsTUFBTSxDQUFDLEtBQUssU0FBUyxDQUFDLENBQUMsQ0FBQztnQkFDMUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxFQUFDLENBQUMsQ0FBQyxDQUFBO1lBQ2hELENBQUM7UUFDTCxDQUFDO1FBQ0QsSUFBSSxDQUFDLGFBQWEsRUFBRSxDQUFBO0lBQ3hCLENBQUM7SUFFRDs7T0FFRztJQUNILElBQUk7UUFDQSxJQUFJLENBQUMsWUFBWSxHQUFHLEVBQUUsQ0FBQTtRQUN0QixJQUFJLENBQUMsYUFBYSxFQUFFLENBQUE7SUFDeEIsQ0FBQztJQUVEOztPQUVHO0lBQ0gsV0FBVyxDQUFDLFNBQWlCO1FBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQTtJQUN0RCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxjQUFjLENBQUMsa0JBQTBCO1FBQ3JDLElBQUksVUFBVSxHQUFZLEtBQUssQ0FBQTtRQUMvQixHQUFHLENBQUMsQ0FBQyxJQUFJLFVBQVUsSUFBSSxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUEsQ0FBQztZQUN0QyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLFVBQVUsRUFBQyxrQkFBa0IsQ0FBQyxDQUFDLENBQUMsQ0FBQztnQkFDbkQsVUFBVSxHQUFHLElBQUksQ0FBQTtZQUNyQixDQUFDO1FBQ0wsQ0FBQztRQUNELE1BQU0sQ0FBQyxVQUFVLENBQUE7SUFDckIsQ0FBQztJQUVEOztPQUVHO0lBQ0gsWUFBWTtRQUNSLE1BQU0sQ0FBQyxDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsTUFBTSxLQUFLLENBQUMsQ0FBQyxDQUFBO0lBQzNDLENBQUM7SUFFRDs7T0FFRztJQUNILGNBQWM7UUFDVixNQUFNLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFBO0lBQ3RELENBQUM7SUFFRCxzQkFBc0I7SUFFdEI7O09BRUc7SUFDSCxpQkFBaUIsQ0FBQyxXQUE2QixFQUFDLGFBQWE7UUFDekQsSUFBSSxDQUFDLDhCQUE4QixDQUFDLElBQUksQ0FDcEM7WUFDSSxJQUFJLE1BQU0sR0FBRyxXQUFXLEVBQUUsQ0FBQTtZQUMxQixFQUFFLENBQUMsQ0FBQyxNQUFNLEtBQUssSUFBSSxDQUFDLENBQUMsQ0FBQztnQkFDbEIsYUFBYSxFQUFFLENBQUE7WUFDbkIsQ0FBQztZQUNELE1BQU0sQ0FBQyxNQUFNLENBQUE7UUFDakIsQ0FBQyxDQUNKLENBQUE7UUFDRCxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUE7SUFDeEIsQ0FBQztJQUVEOztPQUVHO0lBQ0ssYUFBYTtRQUNqQixJQUFJLGFBQWEsR0FBRyxJQUFJLENBQUMsOEJBQThCLENBQUMsTUFBTSxDQUFDLENBQUMsV0FBVztZQUN2RSxNQUFNLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQTtRQUN6QixDQUFDLENBQUMsQ0FBQTtRQUNGLElBQUksQ0FBQyw4QkFBOEIsR0FBRyxhQUFhLENBQUE7SUFDdkQsQ0FBQztDQUVKO0FBdkdELDhCQXVHQyJ9
|
|
46
docs/index.md
Normal file
46
docs/index.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# lik
|
||||||
|
|
||||||
|
light little helpers for node
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/lik)
|
||||||
|
[](https://GitLab.com/pushrocks/lik)
|
||||||
|
[](https://github.com/pushrocks/lik)
|
||||||
|
[](https://pushrocks.gitlab.io/lik/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
|
||||||
|
[](https://GitLab.com/pushrocks/lik/commits/master)
|
||||||
|
[](https://GitLab.com/pushrocks/lik/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/lik)
|
||||||
|
[](https://david-dm.org/pushrocks/lik)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/lik/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/lik)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
@ -1,10 +1,16 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"globalNpmTools": [
|
"npmGlobalTools": [],
|
||||||
"npmts"
|
"npmAccessLevel": "public"
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"npmts": {
|
"gitzone": {
|
||||||
"coverageTreshold": 40
|
"module": {
|
||||||
}
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "lik",
|
||||||
|
"shortDescription": "light little helpers for node",
|
||||||
|
"npmPackagename": "@pushrocks/lik",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
1785
package-lock.json
generated
Normal file
1785
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "lik",
|
"name": "@pushrocks/lik",
|
||||||
"version": "1.0.30",
|
"version": "3.0.9",
|
||||||
|
"private": false,
|
||||||
"description": "light little helpers for node",
|
"description": "light little helpers for node",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(tstest test/)",
|
||||||
|
"build": "(tsbuild)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -18,18 +20,32 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/lik#README",
|
"homepage": "https://gitlab.com/pushrocks/lik#README",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/should": "^8.1.30",
|
"@gitzone/tsbuild": "^2.1.11",
|
||||||
"should": "^11.2.1",
|
"@gitzone/tsrun": "^1.2.8",
|
||||||
"typings-test": "^1.0.3"
|
"@gitzone/tstest": "^1.0.24",
|
||||||
|
"@pushrocks/tapbundle": "^3.0.11",
|
||||||
|
"@types/node": "^12.6.9",
|
||||||
|
"tslint": "^5.18.0",
|
||||||
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/lodash": "^4.14.62",
|
"@pushrocks/smartdelay": "^2.0.3",
|
||||||
"@types/minimatch": "2.x.x",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"@types/q": "1.x.x",
|
"@pushrocks/smartrx": "^2.0.3",
|
||||||
"lodash": "^4.17.4",
|
"@pushrocks/smarttime": "^3.0.12",
|
||||||
"minimatch": "^3.0.3",
|
"@types/minimatch": "^3.0.3",
|
||||||
"q": "^1.5.0",
|
"minimatch": "^3.0.4",
|
||||||
"rxjs": "^5.3.0",
|
"symbol-tree": "^3.2.4"
|
||||||
"typings-global": "^1.0.14"
|
},
|
||||||
}
|
"files": [
|
||||||
|
"ts/*",
|
||||||
|
"ts_web/*",
|
||||||
|
"dist/*",
|
||||||
|
"dist_web/*",
|
||||||
|
"dist_ts_web/*",
|
||||||
|
"assets/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
25
test/test.interestmap.ts
Normal file
25
test/test.interestmap.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||||||
|
import * as lik from '../ts/index';
|
||||||
|
|
||||||
|
let testInterestmap: lik.InterestMap<number, number>;
|
||||||
|
|
||||||
|
tap.test('should create an interestmap', async () => {
|
||||||
|
testInterestmap = new lik.InterestMap(numberArg => {
|
||||||
|
return numberArg.toString();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should create an interest', async () => {
|
||||||
|
testInterestmap.addInterest(3);
|
||||||
|
testInterestmap.addInterest(4);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should return an already existing interest', async () => {
|
||||||
|
await testInterestmap.addInterest(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should be able to inform about a lost interest', async () => {
|
||||||
|
testInterestmap.informLostInterest(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
127
test/test.js
127
test/test.js
File diff suppressed because one or more lines are too long
17
test/test.limitedarray.ts
Normal file
17
test/test.limitedarray.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
|
import { LimitedArray } from '../ts/index';
|
||||||
|
|
||||||
|
let testLimitedArray: LimitedArray<string>;
|
||||||
|
|
||||||
|
tap.test('should create a LimitedArray', async () => {
|
||||||
|
testLimitedArray = new LimitedArray(6);
|
||||||
|
expect(testLimitedArray).to.be.instanceof(LimitedArray);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should never be longer than the set length', async () => {
|
||||||
|
testLimitedArray.addMany(['hi', 'this', 'is', 'quite', 'a', 'long', 'string', ':)']);
|
||||||
|
expect(testLimitedArray.array.length).to.be.lessThan(7);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
26
test/test.looptracker.ts
Normal file
26
test/test.looptracker.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// import test framework
|
||||||
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
import * as events from 'events';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
// import the module
|
||||||
|
import * as lik from '../ts/index';
|
||||||
|
|
||||||
|
let object1 = {};
|
||||||
|
let object2 = {};
|
||||||
|
let myLoopTracker: lik.LoopTracker<any>;
|
||||||
|
|
||||||
|
// tests
|
||||||
|
tap.test('should create a valid looptracker instance', async () => {
|
||||||
|
myLoopTracker = new lik.LoopTracker();
|
||||||
|
expect(myLoopTracker).to.be.instanceof(lik.LoopTracker);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should add objects once and return true', async () => {
|
||||||
|
expect(myLoopTracker.checkAndTrack(object1)).to.be.true;
|
||||||
|
expect(myLoopTracker.checkAndTrack(object1)).to.be.false;
|
||||||
|
expect(myLoopTracker.checkAndTrack(object2)).to.be.true;
|
||||||
|
expect(myLoopTracker.checkAndTrack(object2)).to.be.false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
78
test/test.objectmap.ts
Normal file
78
test/test.objectmap.ts
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// import test framework
|
||||||
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
import * as events from 'events';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
// import the module
|
||||||
|
import * as lik from '../ts/index';
|
||||||
|
|
||||||
|
// Objectmap
|
||||||
|
interface ITestObject {
|
||||||
|
propOne: string;
|
||||||
|
propTwo: string;
|
||||||
|
}
|
||||||
|
let testObjectmap: lik.Objectmap<ITestObject>;
|
||||||
|
let testObject1: ITestObject = {
|
||||||
|
propOne: 'hello',
|
||||||
|
propTwo: 'hello2'
|
||||||
|
};
|
||||||
|
let testObject2: ITestObject = {
|
||||||
|
propOne: 'hello',
|
||||||
|
propTwo: 'hello2'
|
||||||
|
};
|
||||||
|
|
||||||
|
tap.test('new lik.Objectmap() -> should correctly instantiate an Objectmap', async () => {
|
||||||
|
testObjectmap = new lik.Objectmap<ITestObject>();
|
||||||
|
expect(testObjectmap).be.instanceof(lik.Objectmap);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('lik.Objectmap.add() -> should correctly add an object to Objectmap', async () => {
|
||||||
|
testObjectmap.add(testObject1);
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testObjectmap.checkForObject(testObject1)).be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testObjectmap.checkForObject(testObject2)).be.false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('lik.Objectmap.remove() -> should correctly remove an object to Objectmap', async () => {
|
||||||
|
testObjectmap.add(testObject2);
|
||||||
|
testObjectmap.remove(testObject1);
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testObjectmap.checkForObject(testObject1)).be.false;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testObjectmap.checkForObject(testObject2)).be.true;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('Objectmap.forEach -> should correctly run a function forEach map object', async () => {
|
||||||
|
testObjectmap.forEach(itemArg => {
|
||||||
|
expect(itemArg).to.have.property('propOne');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('lik.Objectmap.find() -> should correctly find an object', async () => {
|
||||||
|
let myObject = { propOne: 'helloThere', propTwo: 'helloAnyway' };
|
||||||
|
testObjectmap.add(myObject);
|
||||||
|
let referenceObject = testObjectmap.find(itemArg => {
|
||||||
|
return itemArg.propOne === 'helloThere';
|
||||||
|
});
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(myObject === referenceObject).be.true;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('lik.Objectmap.getArray() -> should return a cloned array', async () => {
|
||||||
|
let myObject = { propOne: 'test1', propTwo: 'wow, how awesome' };
|
||||||
|
testObjectmap.add(myObject);
|
||||||
|
let clonedArray = testObjectmap.getArray();
|
||||||
|
expect(clonedArray[clonedArray.length - 1]).to.eql(myObject);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should get one object and then remove it', async () => {
|
||||||
|
let originalLength = testObjectmap.getArray().length;
|
||||||
|
let oneObject = testObjectmap.getOneAndRemove();
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(oneObject).not.be.null;
|
||||||
|
expect(testObjectmap.getArray().length).equal(originalLength - 1);
|
||||||
|
expect(testObjectmap.getArray()).to.not.contain(oneObject);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
88
test/test.stringmap.ts
Normal file
88
test/test.stringmap.ts
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
// import test framework
|
||||||
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
import * as events from 'events';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
// import the module
|
||||||
|
import * as lik from '../ts/index';
|
||||||
|
|
||||||
|
// testData
|
||||||
|
let testStringmap: lik.Stringmap;
|
||||||
|
let testString1 = 'testString1';
|
||||||
|
let testString2 = 'testString2';
|
||||||
|
let testString3 = 'testString3';
|
||||||
|
let testString4 = 'testString4';
|
||||||
|
let testString5 = 'testString5';
|
||||||
|
let testString6 = 'testString6';
|
||||||
|
|
||||||
|
// tests
|
||||||
|
tap.test('new lik.Objectmap() -> should create an instance of Stringmap', async () => {
|
||||||
|
testStringmap = new lik.Stringmap();
|
||||||
|
expect(testStringmap).be.instanceof(lik.Stringmap);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test(
|
||||||
|
'lik.Stringmap.checkString -> should return false for an string not in Stringmap',
|
||||||
|
async () => {
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkString(testString1)).be.false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
tap.test('lik.Stringmap.addString -> should add an string to Stringmap', async () => {
|
||||||
|
testStringmap.addString(testString1);
|
||||||
|
testStringmap.addString(testString2);
|
||||||
|
testStringmap.addString(testString3);
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkString(testString1)).be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkString(testString2)).be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkString(testString3)).be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkMinimatch('*String1')).be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkMinimatch('*String2')).be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkMinimatch('*String4')).be.false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('lik.Stringmap.addStringArray -> should add an array of strings', async () => {
|
||||||
|
testStringmap.addStringArray([testString4, testString5, testString6]);
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkMinimatch('*String4')).be.true;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('lik.Stringmap.removeString -> should remove a string from Stringmap', async () => {
|
||||||
|
testStringmap.removeString(testString2);
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(testStringmap.checkString(testString2)).be.false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('lik.Stringmap.getStringArray() -> should return a copy of stringArray', async () => {
|
||||||
|
let clonedArray = testStringmap.getStringArray();
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(clonedArray[0] === 'testString1').be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(clonedArray[0] === testString1).be.true;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test(
|
||||||
|
'lik.Stringmap.checkIsEmpty() -> should register a function to trigger when empty',
|
||||||
|
async () => {
|
||||||
|
testStringmap.registerUntilTrue(
|
||||||
|
() => {
|
||||||
|
return testStringmap.checkIsEmpty();
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
console.log('Stringmap now is empty');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
tap.test('lik.Stringmap.empty() -> should remove wipe and then notify', async () => {
|
||||||
|
testStringmap.wipe();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
25
test/test.timedaggregator.ts
Normal file
25
test/test.timedaggregator.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// import test framework
|
||||||
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
import * as events from 'events';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
// import the module
|
||||||
|
import * as lik from '../ts/index';
|
||||||
|
|
||||||
|
let testTimedAggregator: lik.TimedAggregtor<string>;
|
||||||
|
|
||||||
|
tap.test('should create a timed aggregaotor', async tools => {
|
||||||
|
testTimedAggregator = new lik.TimedAggregtor<string>({
|
||||||
|
aggregationIntervalInMillis: 1000,
|
||||||
|
functionForAggregation: aggregation => {
|
||||||
|
console.log(aggregation);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
testTimedAggregator.add('This');
|
||||||
|
testTimedAggregator.add('is a whole sentence.');
|
||||||
|
await tools.delayFor(1001);
|
||||||
|
testTimedAggregator.add('This one is another.');
|
||||||
|
await tools.delayFor(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
40
test/test.tree.ts
Normal file
40
test/test.tree.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||||||
|
import * as lik from '../ts/index';
|
||||||
|
|
||||||
|
class TestClass {
|
||||||
|
constructor(public hey: string) {
|
||||||
|
// nothing here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let testTree = new lik.Tree<TestClass>();
|
||||||
|
|
||||||
|
let testInstance = new TestClass('first');
|
||||||
|
let testInstance2 = new TestClass('second');
|
||||||
|
let testInstance3 = new TestClass('third');
|
||||||
|
let testInstance4 = new TestClass('fourth');
|
||||||
|
let testInstance5 = new TestClass('fifth');
|
||||||
|
let testInstance6 = new TestClass('sixth');
|
||||||
|
|
||||||
|
tap.test('create a valid tree instance', async () => {
|
||||||
|
testTree = new lik.Tree();
|
||||||
|
expect(testTree).to.be.instanceOf(lik.Tree);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should insert an object', async () => {
|
||||||
|
testTree.initialize(testInstance);
|
||||||
|
let resultArray = testTree.treeToArray(testInstance, {});
|
||||||
|
expect(resultArray).to.contain(testInstance);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should add other objects in a hierachy', async () => {
|
||||||
|
testTree.appendChild(testInstance, testInstance2);
|
||||||
|
testTree.appendChild(testInstance, testInstance3);
|
||||||
|
testTree.appendChild(testInstance, testInstance4);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test("should create a JSON object that reflects a tree's hierachy", async () => {
|
||||||
|
const jsonTreet = testTree.toJsonWithHierachy(testInstance);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
135
test/test.ts
135
test/test.ts
@ -1,134 +1 @@
|
|||||||
import 'typings-test'
|
import './test.objectmap';
|
||||||
import * as events from 'events'
|
|
||||||
import * as rx from 'rxjs/Rx'
|
|
||||||
import * as should from 'should'
|
|
||||||
|
|
||||||
import lik = require('../dist/index')
|
|
||||||
describe('lik',function(){
|
|
||||||
describe('Stringmap',function(){
|
|
||||||
let testStringmap: lik.Stringmap
|
|
||||||
let testString1 = 'testString1'
|
|
||||||
let testString2 = 'testString2'
|
|
||||||
let testString3 = 'testString3'
|
|
||||||
let testString4 = 'testString4'
|
|
||||||
let testString5 = 'testString5'
|
|
||||||
let testString6 = 'testString6'
|
|
||||||
it('new lik.Objectmap() -> should create an instance of Stringmap',function(){
|
|
||||||
testStringmap = new lik.Stringmap()
|
|
||||||
should(testStringmap).be.instanceof(lik.Stringmap)
|
|
||||||
})
|
|
||||||
it('lik.Stringmap.checkString -> should return false for an string not in Stringmap',function(){
|
|
||||||
should(testStringmap.checkString(testString1)).be.false()
|
|
||||||
})
|
|
||||||
it('lik.Stringmap.addString -> should add an string to Stringmap',function(){
|
|
||||||
testStringmap.addString(testString1)
|
|
||||||
testStringmap.addString(testString2)
|
|
||||||
testStringmap.addString(testString3)
|
|
||||||
should(testStringmap.checkString(testString1)).be.true()
|
|
||||||
should(testStringmap.checkString(testString2)).be.true()
|
|
||||||
should(testStringmap.checkString(testString3)).be.true()
|
|
||||||
should(testStringmap.checkMinimatch('*String1')).be.true()
|
|
||||||
should(testStringmap.checkMinimatch('*String2')).be.true()
|
|
||||||
should(testStringmap.checkMinimatch('*String4')).be.false()
|
|
||||||
})
|
|
||||||
it('lik.Stringmap.addStringArray -> should add an array of strings',function(){
|
|
||||||
testStringmap.addStringArray([testString4,testString5,testString6])
|
|
||||||
should(testStringmap.checkMinimatch('*String4')).be.true()
|
|
||||||
})
|
|
||||||
it('lik.Stringmap.removeString -> should remove a string from Stringmap',function(){
|
|
||||||
testStringmap.removeString(testString2)
|
|
||||||
should(testStringmap.checkString(testString2)).be.false()
|
|
||||||
})
|
|
||||||
it('lik.Stringmap.getStringArray() -> should return a copy of stringArray',function(){
|
|
||||||
let clonedArray = testStringmap.getStringArray()
|
|
||||||
should(clonedArray[0] === 'testString1').be.true()
|
|
||||||
should(clonedArray[0] === testString1).be.true()
|
|
||||||
})
|
|
||||||
it('lik.Stringmap.checkIsEmpty() -> should register a function to trigger when empty',function(){
|
|
||||||
testStringmap.registerUntilTrue(
|
|
||||||
() => { return testStringmap.checkIsEmpty() },
|
|
||||||
() => { console.log('Stringmap now is empty') }
|
|
||||||
)
|
|
||||||
})
|
|
||||||
it('lik.Stringmap.empty() -> should remove wipe and then notify',function(){
|
|
||||||
testStringmap.wipe()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('Objectmap',function(){
|
|
||||||
interface ITestObject {
|
|
||||||
propOne: string
|
|
||||||
propTwo: string
|
|
||||||
}
|
|
||||||
let testObjectmap: lik.Objectmap<ITestObject>
|
|
||||||
let testObject1: ITestObject = {
|
|
||||||
propOne: 'hello',
|
|
||||||
propTwo: 'hello2'
|
|
||||||
}
|
|
||||||
let testObject2: ITestObject = {
|
|
||||||
propOne: 'hello',
|
|
||||||
propTwo: 'hello2'
|
|
||||||
}
|
|
||||||
it('new lik.Objectmap() -> should correctly instantiate an Objectmap',function(){
|
|
||||||
testObjectmap = new lik.Objectmap<ITestObject>()
|
|
||||||
should(testObjectmap).be.instanceof(lik.Objectmap)
|
|
||||||
})
|
|
||||||
it('lik.Objectmap.add() -> should correctly add an object to Objectmap',function(){
|
|
||||||
testObjectmap.add(testObject1)
|
|
||||||
should(testObjectmap.checkForObject(testObject1)).be.true
|
|
||||||
should(testObjectmap.checkForObject(testObject2)).be.false
|
|
||||||
})
|
|
||||||
it('lik.Objectmap.remove() -> should correctly remove an object to Objectmap',function(){
|
|
||||||
testObjectmap.add(testObject2)
|
|
||||||
testObjectmap.remove(testObject1)
|
|
||||||
should(testObjectmap.checkForObject(testObject1)).be.false
|
|
||||||
should(testObjectmap.checkForObject(testObject2)).be.true
|
|
||||||
})
|
|
||||||
it('Objectmap.forEach -> should correctly run a function forEach map object',function(){
|
|
||||||
testObjectmap.forEach(itemArg => {
|
|
||||||
should(itemArg).have.ownProperty('propOne')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
it('lik.Objectmap.find() -> should correctly find an object',function(){
|
|
||||||
let myObject = {propOne: 'helloThere', propTwo: 'helloAnyway'}
|
|
||||||
testObjectmap.add(myObject)
|
|
||||||
let referenceObject = testObjectmap.find((itemArg) => { return (itemArg.propOne === 'helloThere') })
|
|
||||||
should(myObject === referenceObject).be.true()
|
|
||||||
})
|
|
||||||
it('lik.Objectmap.getArray() -> should return a cloned array', function(){
|
|
||||||
let myObject = {propOne : 'test1', propTwo: 'wow, how awesome'}
|
|
||||||
testObjectmap.add(myObject)
|
|
||||||
let clonedArray = testObjectmap.getArray()
|
|
||||||
should(clonedArray[clonedArray.length - 1]).eql(myObject)
|
|
||||||
})
|
|
||||||
it('should get one object and then remove it', function() {
|
|
||||||
let originalLength = testObjectmap.getArray().length
|
|
||||||
let oneObject = testObjectmap.getOneAndRemove()
|
|
||||||
should(oneObject).not.be.null()
|
|
||||||
should(testObjectmap.getArray().length).equal(originalLength - 1)
|
|
||||||
should(testObjectmap.getArray()).not.containEql(oneObject)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('Observablemap',function(){
|
|
||||||
let testObservablemap: lik.Observablemap
|
|
||||||
let testObservable1: rx.Observable<any>
|
|
||||||
let testObservable2: rx.Observable<any>
|
|
||||||
let testObservable3: rx.Observable<any>
|
|
||||||
let testEmitter: events.EventEmitter
|
|
||||||
it('should create an instance',function(){
|
|
||||||
testObservablemap = new lik.Observablemap()
|
|
||||||
should(testObservablemap).be.instanceof(lik.Observablemap)
|
|
||||||
})
|
|
||||||
it('should accept a new emitter',function(done) {
|
|
||||||
testEmitter = new events.EventEmitter()
|
|
||||||
testObservable1 = testObservablemap.getObservableForEmitterEvent(testEmitter,'event1')
|
|
||||||
testObservable1.subscribe(x => {
|
|
||||||
done()
|
|
||||||
})
|
|
||||||
testObservable2 = testObservablemap.getObservableForEmitterEvent(testEmitter,'event1')
|
|
||||||
testObservable3 = testObservablemap.getObservableForEmitterEvent(testEmitter, 'event2')
|
|
||||||
should(testObservable1 === testObservable2).be.true()
|
|
||||||
should(testObservable1 === testObservable3).be.false()
|
|
||||||
testEmitter.emit('event1')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
12
ts/index.ts
12
ts/index.ts
@ -1,7 +1,11 @@
|
|||||||
import * as plugins from './lik.plugins'
|
import * as plugins from './lik.plugins';
|
||||||
|
|
||||||
// import modules
|
// import modules
|
||||||
|
|
||||||
export * from './lik.stringmap'
|
export * from './lik.interestmap';
|
||||||
export * from './lik.objectmap'
|
export * from './lik.limitedarray';
|
||||||
export * from './lik.observablemap'
|
export * from './lik.looptracker';
|
||||||
|
export * from './lik.objectmap';
|
||||||
|
export * from './lik.stringmap';
|
||||||
|
export * from './lik.timedaggregator';
|
||||||
|
export * from './lik.tree';
|
||||||
|
78
ts/lik.interestmap.interest.ts
Normal file
78
ts/lik.interestmap.interest.ts
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import * as plugins from './lik.plugins';
|
||||||
|
|
||||||
|
import { InterestMap, IInterestComparisonFunc } from './lik.interestmap';
|
||||||
|
|
||||||
|
export class Interest<DTInterestId, DTInterestFullfillment> {
|
||||||
|
private interestMapRef: InterestMap<DTInterestId, DTInterestFullfillment>;
|
||||||
|
public originalInterest: DTInterestId;
|
||||||
|
public comparisonFunc: IInterestComparisonFunc<DTInterestId>;
|
||||||
|
public destructionTimer = new plugins.smarttime.Timer(10000);
|
||||||
|
public isFullfilled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a generic store to store objects in that are needed for fullfillment;
|
||||||
|
*/
|
||||||
|
public fullfillmentStore: any[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* quick access to a string that makes the interest comparable for checking for similar interests
|
||||||
|
*/
|
||||||
|
public get comparisonString() {
|
||||||
|
return this.comparisonFunc(this.originalInterest);
|
||||||
|
}
|
||||||
|
|
||||||
|
private interestDeferred: plugins.smartpromise.Deferred<
|
||||||
|
DTInterestFullfillment
|
||||||
|
> = new plugins.smartpromise.Deferred();
|
||||||
|
public interestFullfilled = this.interestDeferred.promise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fullfill the interest
|
||||||
|
*/
|
||||||
|
public fullfillInterest(objectArg: DTInterestFullfillment) {
|
||||||
|
this.isFullfilled = true;
|
||||||
|
this.fullfillmentStore = [];
|
||||||
|
this.interestDeferred.resolve(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
interestMapArg: InterestMap<DTInterestId, DTInterestFullfillment>,
|
||||||
|
interestArg: DTInterestId,
|
||||||
|
comparisonFuncArg: IInterestComparisonFunc<DTInterestId>
|
||||||
|
) {
|
||||||
|
this.originalInterest = interestArg;
|
||||||
|
this.comparisonFunc = comparisonFuncArg;
|
||||||
|
this.interestMapRef = interestMapArg;
|
||||||
|
this.destructionTimer.completed.then(() => {
|
||||||
|
this.destroy();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// LIFECYCLE MANAGEMENT
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* self destructs the interest
|
||||||
|
*/
|
||||||
|
public destroy() {
|
||||||
|
this.interestMapRef.removeInterest(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* notifies the interest that the interest in it has been lost
|
||||||
|
*/
|
||||||
|
public markLost() {
|
||||||
|
this.destructionTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* notifies the interest that the interest in it has been restored
|
||||||
|
*/
|
||||||
|
public renew() {
|
||||||
|
this.destructionTimer.reset();
|
||||||
|
}
|
||||||
|
}
|
114
ts/lik.interestmap.ts
Normal file
114
ts/lik.interestmap.ts
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import * as plugins from './lik.plugins';
|
||||||
|
import { Objectmap } from './lik.objectmap';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { Interest } from './lik.interestmap.interest';
|
||||||
|
|
||||||
|
export type IInterestComparisonFunc<T> = (objectArg: T) => string;
|
||||||
|
|
||||||
|
export class InterestMap<DTInterestId, DTInterestFullfillment> {
|
||||||
|
/**
|
||||||
|
* stores interests that are currently fullfilled by the cache
|
||||||
|
*/
|
||||||
|
private interestObjectMap = new Objectmap<Interest<DTInterestId, DTInterestFullfillment>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a function to compare interests
|
||||||
|
*/
|
||||||
|
private comparisonFunc: IInterestComparisonFunc<DTInterestId>;
|
||||||
|
|
||||||
|
constructor(comparisonFuncArg: IInterestComparisonFunc<DTInterestId>) {
|
||||||
|
this.comparisonFunc = comparisonFuncArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds an interest to the InterestMap
|
||||||
|
* @param objectArg
|
||||||
|
*/
|
||||||
|
public async addInterest(
|
||||||
|
objectArg: DTInterestId
|
||||||
|
): Promise<Interest<DTInterestId, DTInterestFullfillment>> {
|
||||||
|
const comparisonString = this.comparisonFunc(objectArg);
|
||||||
|
let returnInterest: Interest<DTInterestId, DTInterestFullfillment>;
|
||||||
|
const newInterest = new Interest<DTInterestId, DTInterestFullfillment>(
|
||||||
|
this,
|
||||||
|
objectArg,
|
||||||
|
this.comparisonFunc
|
||||||
|
);
|
||||||
|
let interestExists = false;
|
||||||
|
await this.interestObjectMap.forEach(interestArg => {
|
||||||
|
if (!interestExists && interestArg.comparisonString === newInterest.comparisonString) {
|
||||||
|
console.log('info', `interest already exists for ${newInterest.comparisonString}`);
|
||||||
|
interestExists = true;
|
||||||
|
returnInterest = interestArg;
|
||||||
|
returnInterest.renew();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!returnInterest) {
|
||||||
|
returnInterest = newInterest;
|
||||||
|
this.interestObjectMap.add(returnInterest);
|
||||||
|
}
|
||||||
|
this.interestObservable.push(returnInterest);
|
||||||
|
return returnInterest;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tslint:disable-next-line:member-ordering
|
||||||
|
public interestObservable = new plugins.smartrx.ObservableIntake<Interest<DTInterestId, any>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* removes an interest from the interest map
|
||||||
|
* @param objectArg removes an interest from the InterestMap
|
||||||
|
*/
|
||||||
|
public removeInterest(interestArg: Interest<DTInterestId, DTInterestFullfillment>) {
|
||||||
|
const interestToRemove = this.interestObjectMap.findOneAndRemove(interestArg2 => {
|
||||||
|
return interestArg.comparisonString === interestArg2.comparisonString;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check interest
|
||||||
|
*/
|
||||||
|
public checkInterest(objectArg: DTInterestId): boolean {
|
||||||
|
const comparisonString = this.comparisonFunc(objectArg);
|
||||||
|
return this.checkInterestByString(comparisonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks an interest
|
||||||
|
* @param comparisonStringArg
|
||||||
|
*/
|
||||||
|
public checkInterestByString(comparisonStringArg: string): boolean {
|
||||||
|
const foundInterest = this.interestObjectMap.find(interest => {
|
||||||
|
return interest.comparisonString === comparisonStringArg;
|
||||||
|
});
|
||||||
|
if (foundInterest) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* inform lost interest
|
||||||
|
* @param interestId
|
||||||
|
*/
|
||||||
|
public informLostInterest(interestId: DTInterestId) {
|
||||||
|
const wantedInterest = this.findInterest(interestId);
|
||||||
|
if (wantedInterest) {
|
||||||
|
wantedInterest.markLost();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* finds an interest
|
||||||
|
* @param objectArg
|
||||||
|
*/
|
||||||
|
public findInterest(objectArg: DTInterestId): Interest<DTInterestId, DTInterestFullfillment> {
|
||||||
|
const comparableString = this.comparisonFunc(objectArg);
|
||||||
|
const interest = this.interestObjectMap.find(interest => {
|
||||||
|
return interest.comparisonString === comparableString;
|
||||||
|
});
|
||||||
|
return interest; // if an interest is found, the interest is returned, otherwise interest is null
|
||||||
|
}
|
||||||
|
}
|
42
ts/lik.limitedarray.ts
Normal file
42
ts/lik.limitedarray.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import * as plugins from './lik.plugins';
|
||||||
|
|
||||||
|
export class LimitedArray<T> {
|
||||||
|
array: T[] = [];
|
||||||
|
arrayLimit: number;
|
||||||
|
constructor(limitArg: number) {
|
||||||
|
this.arrayLimit = limitArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
addOne(objectArg: T) {
|
||||||
|
this.array.unshift(objectArg);
|
||||||
|
if (this.array.length > this.arrayLimit) {
|
||||||
|
this.array.length = this.arrayLimit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addMany(objectArrayArg: T[]) {
|
||||||
|
for (let objectArg of objectArrayArg) {
|
||||||
|
this.addOne(objectArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setLimit(limitArg: number) {
|
||||||
|
this.arrayLimit = limitArg;
|
||||||
|
if (this.array.length > this.arrayLimit) {
|
||||||
|
this.array.length = this.arrayLimit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getAverage(): number {
|
||||||
|
if (typeof this.array[0] === 'number') {
|
||||||
|
let sum = 0;
|
||||||
|
for (let localNumber of this.array) {
|
||||||
|
let localNumberAny: any = localNumber;
|
||||||
|
sum = sum + localNumberAny;
|
||||||
|
}
|
||||||
|
return sum / this.array.length;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
ts/lik.looptracker.ts
Normal file
18
ts/lik.looptracker.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import * as plugins from './lik.plugins';
|
||||||
|
|
||||||
|
import { Objectmap } from './lik.objectmap';
|
||||||
|
|
||||||
|
export class LoopTracker<T> {
|
||||||
|
referenceObjectMap = new Objectmap<any>();
|
||||||
|
constructor() {
|
||||||
|
// nothing here
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks and tracks an object
|
||||||
|
* @param objectArg
|
||||||
|
*/
|
||||||
|
checkAndTrack(objectArg: T) {
|
||||||
|
return this.referenceObjectMap.add(objectArg);
|
||||||
|
}
|
||||||
|
}
|
@ -1,121 +1,136 @@
|
|||||||
import * as plugins from './lik.plugins'
|
import * as plugins from './lik.plugins';
|
||||||
|
|
||||||
export interface IObjectmapForEachFunction<T> {
|
export interface IObjectmapForEachFunction<T> {
|
||||||
(itemArg: T): void
|
(itemArg: T): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IObjectmapFindFunction<T> {
|
export interface IObjectmapFindFunction<T> {
|
||||||
(itemArg: T): boolean
|
(itemArg: T): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* allows keeping track of objects
|
* allows keeping track of objects
|
||||||
*/
|
*/
|
||||||
export class Objectmap<T> {
|
export class Objectmap<T> {
|
||||||
private objectArray: T[] = []
|
private objectArray: T[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns a new instance
|
* returns a new instance
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
|
// nothing here
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add object to Objectmap
|
||||||
|
* returns false if the object is already in the map
|
||||||
|
* returns true if the object was added successfully
|
||||||
|
*/
|
||||||
|
public add(objectArg: T): boolean {
|
||||||
|
if (this.checkForObject(objectArg)) {
|
||||||
|
// the object is already in the objectmap
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// the object is not yet in the objectmap
|
||||||
|
this.objectArray.push(objectArg);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add object to Objectmap
|
* like .add but adds an whole array of objects
|
||||||
*/
|
*/
|
||||||
add(objectArg: T) {
|
public addArray(objectArrayArg: T[]) {
|
||||||
this.objectArray.push(objectArg)
|
for (let item of objectArrayArg) {
|
||||||
|
this.add(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* like .add but adds an whole array of objects
|
* check if object is in Objectmap
|
||||||
*/
|
*/
|
||||||
addArray(objectArrayArg: T[]) {
|
public checkForObject(objectArg: T) {
|
||||||
for (let item of objectArrayArg) {
|
return this.objectArray.indexOf(objectArg) !== -1;
|
||||||
this.add(item)
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if object is in Objectmap
|
* find object
|
||||||
*/
|
*/
|
||||||
checkForObject(objectArg: T) {
|
public find(findFunction: IObjectmapFindFunction<T>) {
|
||||||
return this.objectArray.indexOf(objectArg) !== -1
|
const resultArray = this.objectArray.filter(findFunction);
|
||||||
|
if (resultArray.length > 0) {
|
||||||
|
return resultArray[0];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find object
|
* finds a specific element and then removes it
|
||||||
*/
|
*/
|
||||||
find(findFunction: IObjectmapFindFunction<T>) {
|
public findOneAndRemove(findFunction: IObjectmapFindFunction<T>): T {
|
||||||
let resultArray = this.objectArray.filter(findFunction)
|
const foundElement = this.find(findFunction);
|
||||||
if (resultArray.length > 0) {
|
if (foundElement) {
|
||||||
return resultArray[0]
|
this.remove(foundElement);
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return foundElement;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* finds a specific element and then removes it
|
* run function for each item in Objectmap
|
||||||
*/
|
*/
|
||||||
findOneAndRemove(findFunction): T {
|
public async forEach(functionArg: IObjectmapForEachFunction<T>) {
|
||||||
let foundElement = this.find(findFunction)
|
for (let object of this.objectArray) {
|
||||||
if (foundElement) {
|
await functionArg(object);
|
||||||
this.remove(foundElement)
|
|
||||||
}
|
|
||||||
return foundElement
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* run function for each item in Objectmap
|
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
||||||
*/
|
*/
|
||||||
forEach(functionArg: IObjectmapForEachFunction<T>) {
|
public getOneAndRemove(): T {
|
||||||
return this.objectArray.forEach(functionArg)
|
return this.objectArray.shift();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
* returns a cloned array of all the objects currently in the Objectmap
|
||||||
*/
|
*/
|
||||||
getOneAndRemove(): T {
|
public getArray(): T[] {
|
||||||
return this.objectArray.shift()
|
const returnArray: any[] = [];
|
||||||
|
for (const objectItem of this.objectArray) {
|
||||||
|
returnArray.push(objectItem);
|
||||||
}
|
}
|
||||||
|
return returnArray;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns a cloned array of all the objects currently in the Objectmap
|
* check if Objectmap ist empty
|
||||||
*/
|
*/
|
||||||
getArray() {
|
public isEmpty(): boolean {
|
||||||
return plugins.lodash.cloneDeep(this.objectArray)
|
if (this.objectArray.length === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if Objectmap ist empty
|
* remove object from Objectmap
|
||||||
*/
|
*/
|
||||||
isEmpty(): boolean {
|
public remove(objectArg: T) {
|
||||||
if (this.objectArray.length === 0) {
|
let replacementArray = [];
|
||||||
return true
|
for (let item of this.objectArray) {
|
||||||
} else {
|
if (item !== objectArg) {
|
||||||
return false
|
replacementArray.push(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.objectArray = replacementArray;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove object from Objectmap
|
* wipe Objectmap
|
||||||
*/
|
*/
|
||||||
remove(objectArg: T) {
|
public wipe() {
|
||||||
let replacementArray = []
|
this.objectArray = [];
|
||||||
for (let item of this.objectArray) {
|
}
|
||||||
if (item !== objectArg) {
|
|
||||||
replacementArray.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.objectArray = replacementArray
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* wipe Objectmap
|
|
||||||
*/
|
|
||||||
wipe() {
|
|
||||||
this.objectArray = []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
import * as plugins from './lik.plugins'
|
|
||||||
import { Objectmap } from './lik.objectmap'
|
|
||||||
import { Stringmap } from './lik.stringmap'
|
|
||||||
import { Observable } from 'rxjs/Rx'
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bundles an observable with an emitter
|
|
||||||
*/
|
|
||||||
export interface ObservableEmitterBundle {
|
|
||||||
observable: plugins.rx.Observable<any>
|
|
||||||
emitter: plugins.events.EventEmitter
|
|
||||||
event: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* manages observables by making sure that only one observable is regsitered per event
|
|
||||||
*/
|
|
||||||
export class Observablemap {
|
|
||||||
ObservableEmitterBundleObjectmap = new Objectmap<ObservableEmitterBundle>()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* creates a new observable if not yet registered for the same event.
|
|
||||||
* In case event has been registered before the same observable is returned.
|
|
||||||
*/
|
|
||||||
getObservableForEmitterEvent(emitterArg: plugins.events.EventEmitter, eventArg: string) {
|
|
||||||
let existingBundle = this.ObservableEmitterBundleObjectmap.find((bundleArg) => {
|
|
||||||
return(bundleArg.emitter === emitterArg && bundleArg.event === eventArg)
|
|
||||||
})
|
|
||||||
if (existingBundle) {
|
|
||||||
return existingBundle.observable
|
|
||||||
} else {
|
|
||||||
let emitterObservable = plugins.rx.Observable.fromEvent(emitterArg, eventArg)
|
|
||||||
this.ObservableEmitterBundleObjectmap.add({
|
|
||||||
observable: emitterObservable,
|
|
||||||
emitter: emitterArg,
|
|
||||||
event: eventArg
|
|
||||||
})
|
|
||||||
return emitterObservable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,25 @@
|
|||||||
import 'typings-global'
|
// ==============
|
||||||
export import q = require('q')
|
// native
|
||||||
export import events = require('events')
|
// ==============
|
||||||
export import lodash = require('lodash')
|
|
||||||
export import minimatch = require('minimatch')
|
import * as events from 'events';
|
||||||
export import rx = require('rxjs/Rx')
|
|
||||||
|
export { events };
|
||||||
|
|
||||||
|
// ==============
|
||||||
|
// @pushrocks
|
||||||
|
// ==============
|
||||||
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
import * as smartrx from '@pushrocks/smartrx';
|
||||||
|
import * as smarttime from '@pushrocks/smarttime';
|
||||||
|
|
||||||
|
export { smartdelay, smartpromise, smartrx, smarttime };
|
||||||
|
|
||||||
|
// ==============
|
||||||
|
// third party
|
||||||
|
// ==============
|
||||||
|
import minimatch from 'minimatch';
|
||||||
|
const symbolTree = require('symbol-tree');
|
||||||
|
|
||||||
|
export { minimatch, symbolTree };
|
||||||
|
@ -1,114 +1,115 @@
|
|||||||
import * as plugins from './lik.plugins'
|
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 interface ITriggerFunction {
|
||||||
(): boolean
|
(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Stringmap {
|
export class Stringmap {
|
||||||
private _stringArray: string[] = []
|
private _stringArray: string[] = [];
|
||||||
private _triggerUntilTrueFunctionArray: ITriggerFunction[] = []
|
private _triggerUntilTrueFunctionArray: ITriggerFunction[] = [];
|
||||||
constructor() {}
|
constructor() {}
|
||||||
/**
|
/**
|
||||||
* add a string to the Stringmap
|
* add a string to the Stringmap
|
||||||
*/
|
*/
|
||||||
addString(stringArg: string) {
|
addString(stringArg: string) {
|
||||||
this._stringArray.push(stringArg)
|
this._stringArray.push(stringArg);
|
||||||
this.notifyTrigger()
|
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
|
* removes a string from Stringmap
|
||||||
*/
|
*/
|
||||||
addStringArray(stringArrayArg: string[]) {
|
removeString(stringArg: string) {
|
||||||
for (let stringItem of stringArrayArg){
|
for (let keyArg in this._stringArray) {
|
||||||
this.addString(stringItem)
|
if (this._stringArray[keyArg] === stringArg) {
|
||||||
}
|
this._stringArray.splice(parseInt(keyArg), 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.notifyTrigger();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes a string from Stringmap
|
* wipes the Stringmap
|
||||||
*/
|
*/
|
||||||
removeString(stringArg: string) {
|
wipe() {
|
||||||
for (let keyArg in this._stringArray) {
|
this._stringArray = [];
|
||||||
if (this._stringArray[keyArg] === stringArg) {
|
this.notifyTrigger();
|
||||||
this._stringArray.splice(parseInt(keyArg),1)
|
}
|
||||||
}
|
|
||||||
}
|
/**
|
||||||
this.notifyTrigger()
|
* check if string is in Stringmap
|
||||||
|
*/
|
||||||
|
public checkString(stringArg: string): boolean {
|
||||||
|
return this._stringArray.indexOf(stringArg) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks stringPresence with minimatch
|
||||||
|
*/
|
||||||
|
public checkMinimatch(miniMatchStringArg: string): boolean {
|
||||||
|
let foundMatch: boolean = false;
|
||||||
|
for (let stringItem of this._stringArray) {
|
||||||
|
if (plugins.minimatch(stringItem, miniMatchStringArg)) {
|
||||||
|
foundMatch = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return foundMatch;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wipes the Stringmap
|
* checks if the Stringmap is empty
|
||||||
*/
|
*/
|
||||||
wipe() {
|
public checkIsEmpty() {
|
||||||
this._stringArray = []
|
return this._stringArray.length === 0;
|
||||||
this.notifyTrigger()
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets a cloned copy of the current string Array
|
||||||
|
*/
|
||||||
|
public getStringArray() {
|
||||||
|
const returnArray: string[] = [];
|
||||||
|
for (const stringItem of this._stringArray) {
|
||||||
|
returnArray.push(stringItem);
|
||||||
}
|
}
|
||||||
|
return returnArray;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
// trigger registering
|
||||||
* check if string is in Stringmap
|
|
||||||
*/
|
|
||||||
checkString(stringArg: string): boolean {
|
|
||||||
return this._stringArray.indexOf(stringArg) !== -1
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks stringPresence with minimatch
|
* register a new trigger
|
||||||
*/
|
*/
|
||||||
checkMinimatch(miniMatchStringArg: string): boolean {
|
public registerUntilTrue(functionArg: ITriggerFunction, doFunctionArg) {
|
||||||
let foundMatch: boolean = false
|
this._triggerUntilTrueFunctionArray.push(() => {
|
||||||
for (let stringItem of this._stringArray){
|
let result = functionArg();
|
||||||
if (plugins.minimatch(stringItem,miniMatchStringArg)) {
|
if (result === true) {
|
||||||
foundMatch = true
|
doFunctionArg();
|
||||||
}
|
}
|
||||||
}
|
return result;
|
||||||
return foundMatch
|
});
|
||||||
}
|
this.notifyTrigger();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
41
ts/lik.timedaggregator.ts
Normal file
41
ts/lik.timedaggregator.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import * as plugins from './lik.plugins';
|
||||||
|
|
||||||
|
export interface ITimedAggregatorOptions<T> {
|
||||||
|
aggregationIntervalInMillis: number;
|
||||||
|
functionForAggregation: (input: T[]) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TimedAggregtor<T> {
|
||||||
|
public options: ITimedAggregatorOptions<T>;
|
||||||
|
private storageArray: T[] = [];
|
||||||
|
|
||||||
|
constructor(optionsArg: ITimedAggregatorOptions<T>) {
|
||||||
|
this.options = optionsArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private aggregationTimer: plugins.smarttime.Timer;
|
||||||
|
private checkAggregationStatus() {
|
||||||
|
const addAggregationTimer = () => {
|
||||||
|
this.aggregationTimer = new plugins.smarttime.Timer(this.options.aggregationIntervalInMillis);
|
||||||
|
this.aggregationTimer.completed.then(() => {
|
||||||
|
const aggregateForProcessing = this.storageArray;
|
||||||
|
if (aggregateForProcessing.length === 0) {
|
||||||
|
this.aggregationTimer = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.storageArray = [];
|
||||||
|
addAggregationTimer();
|
||||||
|
this.options.functionForAggregation(aggregateForProcessing);
|
||||||
|
});
|
||||||
|
this.aggregationTimer.start();
|
||||||
|
};
|
||||||
|
if (!this.aggregationTimer) {
|
||||||
|
addAggregationTimer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public add(aggregationArg: T) {
|
||||||
|
this.storageArray.push(aggregationArg);
|
||||||
|
this.checkAggregationStatus();
|
||||||
|
}
|
||||||
|
}
|
141
ts/lik.tree.ts
Normal file
141
ts/lik.tree.ts
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
import * as plugins from './lik.plugins';
|
||||||
|
|
||||||
|
export class Tree<T> {
|
||||||
|
symbolTree: any;
|
||||||
|
constructor() {
|
||||||
|
this.symbolTree = new plugins.symbolTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================
|
||||||
|
// Functions that map to the functionality of symbol-tree
|
||||||
|
// =======================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param objectArg
|
||||||
|
*/
|
||||||
|
initialize(objectArg: T): T {
|
||||||
|
return this.symbolTree.initialize(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
hasChildren(objectArg: T): boolean {
|
||||||
|
return this.symbolTree.hasChildren(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
firstChild(objectArg: T): T {
|
||||||
|
return this.symbolTree.firstChild(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastChild(objectArg: T): T {
|
||||||
|
return this.symbolTree.lastChild(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
previousSibling(objectArg: T): T {
|
||||||
|
return this.symbolTree.previousSibling(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
nextSibling(objectArg: T): T {
|
||||||
|
return this.symbolTree.nextSibling(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent(objectArg: T): T {
|
||||||
|
return this.symbolTree.parent(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastInclusiveDescendant(objectArg: T): T {
|
||||||
|
return this.symbolTree.lastInclusiveDescendant(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
preceding(objectArg: T, optionsArg?: any): T {
|
||||||
|
return this.symbolTree.preceding(objectArg, optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
following(object: T, optionsArg: any) {
|
||||||
|
return this.symbolTree.following(object, optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
childrenToArray(parentArg: T, optionsArg: any): T[] {
|
||||||
|
return this.symbolTree.childrenToArray(parentArg, optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
ancestorsToArray(objectArg: T, optionsArg: any): T[] {
|
||||||
|
return this.symbolTree.ancestorsToArray(objectArg, optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
treeToArray(rootArg, optionsArg: any): T[] {
|
||||||
|
return this.symbolTree.treeToArray(rootArg, optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
childrenIterator(parentArg: T, optionsArg): T {
|
||||||
|
return this.symbolTree.childrenIterator(parentArg, optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
previousSiblingsIterator(objectArg): T {
|
||||||
|
return this.symbolTree.previousSiblingsIterator(objectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
nextSiblingsIterator(objectArg: T) {
|
||||||
|
return this.symbolTree.nextSiblingsIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
ancestorsIterator(objectArg) {
|
||||||
|
this.symbolTree.ancestorsIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
treeIterator(rootArg: T, optionsArg): Iterable<T> {
|
||||||
|
return this.symbolTree.treeIterator(rootArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
index(childArg: T): number {
|
||||||
|
return this.symbolTree.index(childArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
childrenCount(parentArg: T): number {
|
||||||
|
return this.symbolTree.childrenCount(parentArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
compareTreePosition(leftArg: T, rightArg: T): number {
|
||||||
|
return this.compareTreePosition(leftArg, rightArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(removeObjectArg: T): T {
|
||||||
|
return this.symbolTree.remove(removeObjectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
insertBefore(referenceObjectArg: T, newObjectArg: T): T {
|
||||||
|
return this.symbolTree.insertBefore(referenceObjectArg, newObjectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
insertAfter(referenceObject: T, newObjectArg: T) {
|
||||||
|
return this.symbolTree.insertAfter(referenceObject, newObjectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
prependChild(referenceObjectArg: T, newObjectArg: T): T {
|
||||||
|
return this.symbolTree.prependChild(referenceObjectArg, newObjectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
appendChild(referenceObjectArg, newObjectArg) {
|
||||||
|
return this.symbolTree.appendChild(referenceObjectArg, newObjectArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================
|
||||||
|
// Functionionality that extends symbol-tree
|
||||||
|
// ===========================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns a branch of the tree as JSON
|
||||||
|
* can be user
|
||||||
|
*/
|
||||||
|
toJsonWithHierachy(rootElement) {
|
||||||
|
const treeIterable = this.treeIterator(rootElement, {});
|
||||||
|
for (const treeItem of treeIterable) {
|
||||||
|
console.log(treeItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* builds a tree from a JSON with hierachy
|
||||||
|
* @param rootElement
|
||||||
|
*/
|
||||||
|
fromJsonWithHierachy(rootElement) {}
|
||||||
|
}
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
||||||
|
186
yarn.lock
186
yarn.lock
@ -1,186 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@types/lodash@^4.14.62":
|
|
||||||
version "4.14.62"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.62.tgz#8674f9861582148a60b7a89cb260f11378d11683"
|
|
||||||
|
|
||||||
"@types/minimatch@2.x.x":
|
|
||||||
version "2.0.29"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
|
|
||||||
|
|
||||||
"@types/mocha@^2.2.31":
|
|
||||||
version "2.2.40"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.40.tgz#9811dd800ece544cd84b5b859917bf584a150c4c"
|
|
||||||
|
|
||||||
"@types/q@1.x.x":
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.0.tgz#57e5465d665b370d4217e69b344b20faa6b724f5"
|
|
||||||
|
|
||||||
"@types/should@^8.1.30":
|
|
||||||
version "8.1.30"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/should/-/should-8.1.30.tgz#e6b4f3ca4fb0799f6ce3303f3a8c003df6585aa3"
|
|
||||||
|
|
||||||
balanced-match@^0.4.1:
|
|
||||||
version "0.4.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
|
||||||
|
|
||||||
brace-expansion@^1.0.0:
|
|
||||||
version "1.1.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59"
|
|
||||||
dependencies:
|
|
||||||
balanced-match "^0.4.1"
|
|
||||||
concat-map "0.0.1"
|
|
||||||
|
|
||||||
concat-map@0.0.1:
|
|
||||||
version "0.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
|
||||||
|
|
||||||
fs.realpath@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
|
||||||
|
|
||||||
glob@^7.0.0:
|
|
||||||
version "7.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
|
|
||||||
dependencies:
|
|
||||||
fs.realpath "^1.0.0"
|
|
||||||
inflight "^1.0.4"
|
|
||||||
inherits "2"
|
|
||||||
minimatch "^3.0.2"
|
|
||||||
once "^1.3.0"
|
|
||||||
path-is-absolute "^1.0.0"
|
|
||||||
|
|
||||||
inflight@^1.0.4:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
|
||||||
dependencies:
|
|
||||||
once "^1.3.0"
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
inherits@2:
|
|
||||||
version "2.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
|
||||||
|
|
||||||
interpret@^1.0.0:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.2.tgz#f4f623f0bb7122f15f5717c8e254b8161b5c5b2d"
|
|
||||||
|
|
||||||
lodash@^4.17.4:
|
|
||||||
version "4.17.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
|
||||||
|
|
||||||
minimatch@^3.0.2, minimatch@^3.0.3:
|
|
||||||
version "3.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
|
||||||
dependencies:
|
|
||||||
brace-expansion "^1.0.0"
|
|
||||||
|
|
||||||
once@^1.3.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
|
||||||
dependencies:
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
path-is-absolute@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
|
||||||
|
|
||||||
path-parse@^1.0.5:
|
|
||||||
version "1.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
|
|
||||||
|
|
||||||
q@^1.5.0:
|
|
||||||
version "1.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
|
|
||||||
|
|
||||||
rechoir@^0.6.2:
|
|
||||||
version "0.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
|
||||||
dependencies:
|
|
||||||
resolve "^1.1.6"
|
|
||||||
|
|
||||||
resolve@^1.1.6:
|
|
||||||
version "1.3.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235"
|
|
||||||
dependencies:
|
|
||||||
path-parse "^1.0.5"
|
|
||||||
|
|
||||||
rxjs@^5.3.0:
|
|
||||||
version "5.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.3.0.tgz#d88ccbdd46af290cbdb97d5d8055e52453fabe2d"
|
|
||||||
dependencies:
|
|
||||||
symbol-observable "^1.0.1"
|
|
||||||
|
|
||||||
semver@^5.3.0:
|
|
||||||
version "5.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
|
||||||
|
|
||||||
shelljs@^0.7.4:
|
|
||||||
version "0.7.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1"
|
|
||||||
dependencies:
|
|
||||||
glob "^7.0.0"
|
|
||||||
interpret "^1.0.0"
|
|
||||||
rechoir "^0.6.2"
|
|
||||||
|
|
||||||
should-equal@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-1.0.1.tgz#0b6e9516f2601a9fb0bb2dcc369afa1c7e200af7"
|
|
||||||
dependencies:
|
|
||||||
should-type "^1.0.0"
|
|
||||||
|
|
||||||
should-format@^3.0.2:
|
|
||||||
version "3.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1"
|
|
||||||
dependencies:
|
|
||||||
should-type "^1.3.0"
|
|
||||||
should-type-adaptors "^1.0.1"
|
|
||||||
|
|
||||||
should-type-adaptors@^1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.0.1.tgz#efe5553cdf68cff66e5c5f51b712dc351c77beaa"
|
|
||||||
dependencies:
|
|
||||||
should-type "^1.3.0"
|
|
||||||
should-util "^1.0.0"
|
|
||||||
|
|
||||||
should-type@^1.0.0, should-type@^1.3.0, should-type@^1.4.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3"
|
|
||||||
|
|
||||||
should-util@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.0.tgz#c98cda374aa6b190df8ba87c9889c2b4db620063"
|
|
||||||
|
|
||||||
should@^11.2.1:
|
|
||||||
version "11.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/should/-/should-11.2.1.tgz#90f55145552d01cfc200666e4e818a1c9670eda2"
|
|
||||||
dependencies:
|
|
||||||
should-equal "^1.0.0"
|
|
||||||
should-format "^3.0.2"
|
|
||||||
should-type "^1.4.0"
|
|
||||||
should-type-adaptors "^1.0.1"
|
|
||||||
should-util "^1.0.0"
|
|
||||||
|
|
||||||
symbol-observable@^1.0.1:
|
|
||||||
version "1.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
|
|
||||||
|
|
||||||
typings-global@*, typings-global@^1.0.14:
|
|
||||||
version "1.0.14"
|
|
||||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c"
|
|
||||||
dependencies:
|
|
||||||
semver "^5.3.0"
|
|
||||||
shelljs "^0.7.4"
|
|
||||||
|
|
||||||
typings-test@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/typings-test/-/typings-test-1.0.3.tgz#fbab895eb3f0c44842e73db059f65946b971e369"
|
|
||||||
dependencies:
|
|
||||||
"@types/mocha" "^2.2.31"
|
|
||||||
typings-global "*"
|
|
||||||
|
|
||||||
wrappy@1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
|
Reference in New Issue
Block a user