From a7484e791a6cf3d7950556d875371d69eaaaecef Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Fri, 23 Nov 2018 20:33:44 +0100 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 20 +- package-lock.json | 473 ++++++++++++++++++++++++++++++--- package.json | 13 +- test/test.interestmap.ts | 25 ++ test/test.tree.ts | 4 +- ts/index.ts | 3 +- ts/lik.interestmap.interest.ts | 76 ++++++ ts/lik.interestmap.ts | 117 ++++++++ ts/lik.objectmap.ts | 32 ++- ts/lik.plugins.ts | 29 +- ts/lik.stringmap.ts | 16 +- tslint.json | 16 +- 12 files changed, 736 insertions(+), 88 deletions(-) create mode 100644 test/test.interestmap.ts create mode 100644 ts/lik.interestmap.interest.ts create mode 100644 ts/lik.interestmap.ts diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b576a0..2522e90 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,6 +26,7 @@ mirror: snyk: stage: security script: + - npmci npm prepare - npmci command npm install -g snyk - npmci command npm install --ignore-scripts - npmci command snyk test @@ -39,6 +40,7 @@ snyk: testLEGACY: stage: test script: + - npmci npm prepare - npmci node install legacy - npmci npm install - npmci npm test @@ -51,6 +53,7 @@ testLEGACY: testLTS: stage: test script: + - npmci npm prepare - npmci node install lts - npmci npm install - npmci npm test @@ -62,6 +65,7 @@ testLTS: testSTABLE: stage: test script: + - npmci npm prepare - npmci node install stable - npmci npm install - npmci npm test @@ -117,8 +121,10 @@ pages: image: hosttoday/ht-docker-node:npmci stage: metadata script: - - npmci command npm install -g npmpage - - npmci command npmpage + - npmci command npm install -g typedoc typescript + - npmci npm prepare + - npmci npm install + - npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ tags: - docker - notpriv @@ -129,13 +135,3 @@ pages: paths: - public allow_failure: true - -windowsCompatibility: - image: stefanscherer/node-windows:10-build-tools - stage: metadata - script: - - npm install & npm test - coverage: /\d+.?\d+?\%\s*coverage/ - tags: - - windows - allow_failure: true diff --git a/package-lock.json b/package-lock.json index b71bbaa..ee666e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,9 +75,9 @@ } }, "@gitzone/tsrun": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/@gitzone/tsrun/-/tsrun-1.1.12.tgz", - "integrity": "sha512-DOxqOg+evoxhgbzhzH4u6LaPF+6bpMsnBVl1QQaHzKPGBlNjaIY4yJ0RsGnWMgX1hlNLvbgHtl0Ky4A2MDvyrg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/@gitzone/tsrun/-/tsrun-1.1.13.tgz", + "integrity": "sha512-yJLXfqu33zGc1hBX4HGxzlBvb5DU2zs80MUd8UsULJvkgOBofb3XR7eyV7iZfP097sd+ABj17yoeqJcRRjOZTg==", "dev": true, "requires": { "@gitzone/tsbuild": "^2.0.22", @@ -180,19 +180,31 @@ "@pushrocks/smartpromise": "^2.0.5" } }, + "@pushrocks/lik": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@pushrocks/lik/-/lik-3.0.1.tgz", + "integrity": "sha512-6dwRg7WMdY9drlqfo6NzOcw5ubVWYvIOSSMZz4Jsojpa8aDVwXd2VkD7sxO/PJRrbZzHkx/JXoY/epcWRjngUw==", + "requires": { + "@pushrocks/smartpromise": "^2.0.5", + "@types/lodash": "^4.14.112", + "@types/minimatch": "^3.0.3", + "lodash": "^4.17.10", + "minimatch": "^3.0.4", + "symbol-tree": "^3.2.2" + } + }, "@pushrocks/smartdelay": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.2.tgz", "integrity": "sha512-4xf6tMKwZcxBynKgXrM4SQKgeASfRvx43LUmR5DkStp26ZHAsarCXUdKJS6y8QIPygEOTOCP8we97JAcCzBuMg==", - "dev": true, "requires": { "@pushrocks/smartpromise": "^2.0.5" } }, "@pushrocks/smartfile": { - "version": "6.0.8", - "resolved": "https://registry.npmjs.org/@pushrocks/smartfile/-/smartfile-6.0.8.tgz", - "integrity": "sha512-YkAovvQ0pcVphXLynlQ1D4nhEoUqALqqUn2pRXc2vXNy0RDSU22puLlLVhoXT0NPAqYNMazhqc4OAixgEOpdFw==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/@pushrocks/smartfile/-/smartfile-6.0.11.tgz", + "integrity": "sha512-qITfYEUtSN478CFyYX0KatIYLV28u/KdO3ClOcKjx1epagpuYhkwfVELhyIDRvapMjuesoVgZcrXUhcvq0o9+w==", "dev": true, "requires": { "@pushrocks/smartpath": "^4.0.1", @@ -200,10 +212,26 @@ "@pushrocks/smartrequest": "^1.1.14", "@types/fs-extra": "^5.0.4", "@types/vinyl": "^2.0.2", - "fs-extra": "^7.0.0", - "glob": "^7.1.2", + "fs-extra": "^7.0.1", + "glob": "^7.1.3", "js-yaml": "^3.10.0", "vinyl-file": "^3.0.0" + }, + "dependencies": { + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } } }, "@pushrocks/smartlog": { @@ -243,6 +271,17 @@ "form-data": "^2.3.2" } }, + "@pushrocks/smartrx": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@pushrocks/smartrx/-/smartrx-2.0.2.tgz", + "integrity": "sha512-3lQONWp/Q/al8O6Cm9v6aSamNAzJimGHNFgHBKKmyBOVZaYrvhd6OMgDDicHE6vkYHXNtltXj5q3aIunz+bKwQ==", + "requires": { + "@pushrocks/lik": "^3.0.1", + "@pushrocks/smartpromise": "^2.0.5", + "rxjs": "^6.3.3", + "smartevent": "^1.0.1" + } + }, "@pushrocks/smartshell": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@pushrocks/smartshell/-/smartshell-2.0.6.tgz", @@ -254,10 +293,20 @@ "which": "^1.3.1" } }, - "@pushrocks/tapbundle": { + "@pushrocks/smarttime": { "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.5.tgz", - "integrity": "sha512-7K1y4pyJ5O8XRmnW/ADryEoniGKOW0Un6VZpxMcYTndS5AjwKhjRkAAaSQf4g/a8Ei+uk/q8csI9Twjb9KISLQ==", + "resolved": "https://registry.npmjs.org/@pushrocks/smarttime/-/smarttime-3.0.5.tgz", + "integrity": "sha512-nHjJ8xRZ87OE8tBBIAOgjHJmJrc3MaPZtEZ5JDY2U9gjaED6JdRcdQ+vhSaLJT+U2u8YzXOuA6LfNN+X4jZm6A==", + "requires": { + "@pushrocks/smartpromise": "^2.0.5", + "@types/luxon": "^1.4.1", + "luxon": "^1.8.0" + } + }, + "@pushrocks/tapbundle": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.7.tgz", + "integrity": "sha512-ZI4fhXPy8XMfiy/QofP0ZDuFdv3cErm+FP/+AXaNKdgCCx01MXNTYSUdER1GPUXW3ZbiXdurkLJlxlhIzD1ZJw==", "dev": true, "requires": { "@pushrocks/early": "^3.0.3", @@ -268,9 +317,9 @@ } }, "@types/chai": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.4.tgz", - "integrity": "sha512-h6+VEw2Vr3ORiFCyyJmcho2zALnUq9cvdB/IO8Xs9itrJVCenC7o26A6+m7D0ihTTr65eS259H5/Ghl/VjYs6g==", + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.7.tgz", + "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", "dev": true }, "@types/chai-as-promised": { @@ -316,9 +365,14 @@ } }, "@types/lodash": { - "version": "4.14.116", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", - "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==" + "version": "4.14.118", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.118.tgz", + "integrity": "sha512-iiJbKLZbhSa6FYRip/9ZDX6HXhayXLDGY2Fqws9cOkEQ6XeKfaxB0sC541mowZJueYyMnVUmmG+al5/4fCDrgw==" + }, + "@types/luxon": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.4.1.tgz", + "integrity": "sha512-mYv/gbkOJ40CDgR8st5sosfFNrJncdlkpdzQSNRdU86UQg3oWWmll4AO/7B8F5FlBC6YrIXqXDSnkoCBqo+uMA==" }, "@types/minimatch": { "version": "3.0.3", @@ -326,9 +380,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "10.9.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.9.4.tgz", - "integrity": "sha512-fCHV45gS+m3hH17zgkgADUSi2RR1Vht6wOZ0jyHP8rjiQra9f+mIcgwPQHllmDocYOstIEbKlxbFDYlgrTPYqw==", + "version": "10.12.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.10.tgz", + "integrity": "sha512-8xZEYckCbUVgK8Eg7lf5Iy4COKJ5uXlnIOnePN0WUwSQggy9tolM+tDJf7wMOnT/JT/W9xDYIaYggt3mRV2O5w==", "dev": true }, "@types/vinyl": { @@ -352,6 +406,18 @@ "integrity": "sha1-kQ3lDvzHwJ49gvL4er1rcAwYgYo=", "dev": true }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -379,6 +445,32 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -405,18 +497,24 @@ "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", "dev": true }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "chai": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", - "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", "dev": true, "requires": { - "assertion-error": "^1.0.1", - "check-error": "^1.0.1", - "deep-eql": "^3.0.0", + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", "get-func-name": "^2.0.0", - "pathval": "^1.0.0", - "type-detect": "^4.0.0" + "pathval": "^1.1.0", + "type-detect": "^4.0.5" } }, "chai-as-promised": { @@ -429,11 +527,42 @@ } }, "chai-string": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.4.0.tgz", - "integrity": "sha1-NZFAwFHTak5LGl/GuRAVL0OKjUk=", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.5.0.tgz", + "integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==", "dev": true }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -469,6 +598,21 @@ "readable-stream": "^2.3.5" } }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "combined-stream": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", @@ -478,6 +622,12 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -498,6 +648,14 @@ "type-detect": "^4.0.0" } }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "requires": { + "object-keys": "^1.0.12" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -510,6 +668,28 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "es-abstract": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", @@ -528,6 +708,12 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, "figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -558,9 +744,9 @@ } }, "fs-extra": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", - "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -574,6 +760,11 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", @@ -611,6 +802,34 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -627,6 +846,32 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "requires": { + "has": "^1.0.1" + } + }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "requires": { + "has-symbols": "^1.0.0" + } + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -645,6 +890,12 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, "js-yaml": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", @@ -684,9 +935,14 @@ "dev": true }, "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "luxon": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.8.0.tgz", + "integrity": "sha512-F742cYUYB7X+LXY3cIn6THZUBqRBjeAvF+CWE2i3+eKcv2bzsCsnRsBYL8Qrqzp1dfs6HsVcSjfKt2RcrtUElw==" }, "make-error": { "version": "1.3.4", @@ -741,11 +997,25 @@ } }, "nan": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", - "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==", + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", + "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==", "dev": true }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -761,6 +1031,12 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", @@ -812,12 +1088,35 @@ "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", "dev": true }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, + "rxjs": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, "smartchai": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/smartchai/-/smartchai-2.0.1.tgz", @@ -832,6 +1131,23 @@ "chai-string": "^1.4.0" } }, + "smartevent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/smartevent/-/smartevent-1.0.1.tgz", + "integrity": "sha1-E9K/LPCU698XgT+g1GBB+BejAqo=", + "requires": { + "smartq": "^1.1.1", + "typings-global": "^1.0.16" + } + }, + "smartq": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz", + "integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==", + "requires": { + "util.promisify": "^1.0.0" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -863,6 +1179,15 @@ "safe-buffer": "~5.1.0" } }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "strip-bom": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", @@ -891,6 +1216,12 @@ "strip-bom": "^2.0.0" } }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, "symbol-tree": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", @@ -912,6 +1243,46 @@ "yn": "^2.0.0" } }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" + }, + "tslint": { + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", + "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.27.2" + } + }, + "tslint-config-prettier": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.16.0.tgz", + "integrity": "sha512-zu6RAcpBtqdvhT6KpBh9kRPYATjOf9BnRi718kNqVKFjEgSE4rFrPprFju1YJrkOa3RbtbWI1ZSuLd2NBX1MDw==", + "dev": true + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -919,11 +1290,16 @@ "dev": true }, "typescript": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", - "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.6.tgz", + "integrity": "sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==", "dev": true }, + "typings-global": { + "version": "1.0.28", + "resolved": "https://registry.npmjs.org/typings-global/-/typings-global-1.0.28.tgz", + "integrity": "sha512-6VOwJWEY2971HOMHu/7sURzUXiD4/LiMJPsMAOqkHHAtS3MVpLFE5gzTiHilsH9KY5VE1mBQirWIgWFsDuo90A==" + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -936,6 +1312,15 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, "vinyl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", diff --git a/package.json b/package.json index 6a65783..bc93df8 100644 --- a/package.json +++ b/package.json @@ -21,16 +21,19 @@ "homepage": "https://gitlab.com/pushrocks/lik#README", "devDependencies": { "@gitzone/tsbuild": "^2.0.22", - "@gitzone/tsrun": "^1.1.12", + "@gitzone/tsrun": "^1.1.13", "@gitzone/tstest": "^1.0.15", - "@pushrocks/tapbundle": "^3.0.5", - "@types/node": "^10.9.4" + "@pushrocks/tapbundle": "^3.0.7", + "@types/node": "^10.12.10", + "tslint": "^5.11.0", + "tslint-config-prettier": "^1.16.0" }, "dependencies": { + "@pushrocks/smartdelay": "^2.0.2", "@pushrocks/smartpromise": "^2.0.5", - "@types/lodash": "^4.14.116", + "@pushrocks/smartrx": "^2.0.2", + "@pushrocks/smarttime": "^3.0.5", "@types/minimatch": "^3.0.3", - "lodash": "^4.17.10", "minimatch": "^3.0.4", "symbol-tree": "^3.2.2" } diff --git a/test/test.interestmap.ts b/test/test.interestmap.ts new file mode 100644 index 0000000..44229e2 --- /dev/null +++ b/test/test.interestmap.ts @@ -0,0 +1,25 @@ +import { tap, expect } from '@pushrocks/tapbundle'; +import * as lik from '../ts/index'; + +let testInterestmap: lik.InterestMap; + +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(); diff --git a/test/test.tree.ts b/test/test.tree.ts index c86b47a..c08c49f 100644 --- a/test/test.tree.ts +++ b/test/test.tree.ts @@ -31,9 +31,9 @@ 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 () => { +tap.test("should create a JSON object that reflects a tree's hierachy", async () => { const jsonTreet = testTree.toJsonWithHierachy(testInstance); }); diff --git a/ts/index.ts b/ts/index.ts index ae87bc3..98edefe 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -2,8 +2,9 @@ import * as plugins from './lik.plugins'; // import modules +export * from './lik.interestmap'; +export * from './lik.limitedarray'; export * from './lik.looptracker'; export * from './lik.objectmap'; export * from './lik.stringmap'; -export * from './lik.limitedarray'; export * from './lik.tree'; diff --git a/ts/lik.interestmap.interest.ts b/ts/lik.interestmap.interest.ts new file mode 100644 index 0000000..15dc59f --- /dev/null +++ b/ts/lik.interestmap.interest.ts @@ -0,0 +1,76 @@ +import * as plugins from './lik.plugins'; + +import { InterestMap, IInterestComparisonFunc} from './lik.interestmap'; + +export class Interest { + private interestMapRef: InterestMap; + public originalInterest: DTInterestId; + public comparisonFunc: IInterestComparisonFunc; + 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 = 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, + interestArg: DTInterestId, + comparisonFuncArg: IInterestComparisonFunc + ) { + 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(); + } +} \ No newline at end of file diff --git a/ts/lik.interestmap.ts b/ts/lik.interestmap.ts new file mode 100644 index 0000000..eb31b6d --- /dev/null +++ b/ts/lik.interestmap.ts @@ -0,0 +1,117 @@ +import * as plugins from './lik.plugins'; +import { Objectmap } from './lik.objectmap'; + +import { Observable } from 'rxjs'; + +import { Interest } from './lik.interestmap.interest'; + +export type IInterestComparisonFunc = (objectArg: T) => string; + + + +export class InterestMap { + /** + * stores interests that are currently fullfilled by the cache + */ + private interestObjectMap = new Objectmap>(); + + /** + * a function to compare interests + */ + private comparisonFunc: IInterestComparisonFunc; + + constructor(comparisonFuncArg: IInterestComparisonFunc) { + this.comparisonFunc = comparisonFuncArg; + } + + /** + * adds an interest to the InterestMap + * @param objectArg + */ + public async addInterest( + objectArg: DTInterestId + ): Promise> { + const comparisonString = this.comparisonFunc(objectArg); + let returnInterest: Interest; + const newInterest = new Interest( + 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>(); + + /** + * removes an interest from the interest map + * @param objectArg removes an interest from the InterestMap + */ + public removeInterest(interestArg: Interest) { + 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 { + 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 + } +} diff --git a/ts/lik.objectmap.ts b/ts/lik.objectmap.ts index 30e8493..16197e3 100644 --- a/ts/lik.objectmap.ts +++ b/ts/lik.objectmap.ts @@ -26,7 +26,7 @@ export class Objectmap { * returns false if the object is already in the map * returns true if the object was added successfully */ - add(objectArg: T): boolean { + public add(objectArg: T): boolean { if (this.checkForObject(objectArg)) { // the object is already in the objectmap return false; @@ -40,7 +40,7 @@ export class Objectmap { /** * like .add but adds an whole array of objects */ - addArray(objectArrayArg: T[]) { + public addArray(objectArrayArg: T[]) { for (let item of objectArrayArg) { this.add(item); } @@ -49,15 +49,15 @@ export class Objectmap { /** * check if object is in Objectmap */ - checkForObject(objectArg: T) { + public checkForObject(objectArg: T) { return this.objectArray.indexOf(objectArg) !== -1; } /** * find object */ - find(findFunction: IObjectmapFindFunction) { - let resultArray = this.objectArray.filter(findFunction); + public find(findFunction: IObjectmapFindFunction) { + const resultArray = this.objectArray.filter(findFunction); if (resultArray.length > 0) { return resultArray[0]; } else { @@ -68,8 +68,8 @@ export class Objectmap { /** * finds a specific element and then removes it */ - findOneAndRemove(findFunction: IObjectmapFindFunction): T { - let foundElement = this.find(findFunction); + public findOneAndRemove(findFunction: IObjectmapFindFunction): T { + const foundElement = this.find(findFunction); if (foundElement) { this.remove(foundElement); } @@ -79,7 +79,7 @@ export class Objectmap { /** * run function for each item in Objectmap */ - async forEach(functionArg: IObjectmapForEachFunction) { + public async forEach(functionArg: IObjectmapForEachFunction) { for (let object of this.objectArray) { await functionArg(object); } @@ -88,21 +88,25 @@ export class Objectmap { /** * gets an object in the Observablemap and removes it, so it can't be retrieved again */ - getOneAndRemove(): T { + public getOneAndRemove(): T { return this.objectArray.shift(); } /** * returns a cloned array of all the objects currently in the Objectmap */ - getArray() { - return plugins.lodash.cloneDeep(this.objectArray); + public getArray() { + const returnArray: any[] = []; + for (const objectItem of this.objectArray) { + returnArray.push(objectItem); + } + return returnArray; } /** * check if Objectmap ist empty */ - isEmpty(): boolean { + public isEmpty(): boolean { if (this.objectArray.length === 0) { return true; } else { @@ -113,7 +117,7 @@ export class Objectmap { /** * remove object from Objectmap */ - remove(objectArg: T) { + public remove(objectArg: T) { let replacementArray = []; for (let item of this.objectArray) { if (item !== objectArg) { @@ -126,7 +130,7 @@ export class Objectmap { /** * wipe Objectmap */ - wipe() { + public wipe() { this.objectArray = []; } } diff --git a/ts/lik.plugins.ts b/ts/lik.plugins.ts index f7f9149..8c7a0e3 100644 --- a/ts/lik.plugins.ts +++ b/ts/lik.plugins.ts @@ -1,7 +1,30 @@ +// ============== +// native +// ============== + import * as events from 'events'; -import * as lodash from 'lodash'; -import * as minimatch from 'minimatch'; + +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 * as minimatch from 'minimatch'; const symbolTree = require('symbol-tree'); -export { events, lodash, minimatch, smartpromise, symbolTree }; +export { minimatch, symbolTree }; diff --git a/ts/lik.stringmap.ts b/ts/lik.stringmap.ts index e137341..9114cfa 100644 --- a/ts/lik.stringmap.ts +++ b/ts/lik.stringmap.ts @@ -52,14 +52,14 @@ export class Stringmap { /** * check if string is in Stringmap */ - checkString(stringArg: string): boolean { + public checkString(stringArg: string): boolean { return this._stringArray.indexOf(stringArg) !== -1; } /** * checks stringPresence with minimatch */ - checkMinimatch(miniMatchStringArg: string): boolean { + public checkMinimatch(miniMatchStringArg: string): boolean { let foundMatch: boolean = false; for (let stringItem of this._stringArray) { if (plugins.minimatch(stringItem, miniMatchStringArg)) { @@ -72,15 +72,19 @@ export class Stringmap { /** * checks if the Stringmap is empty */ - checkIsEmpty() { + public checkIsEmpty() { return this._stringArray.length === 0; } /** * gets a cloned copy of the current string Array */ - getStringArray() { - return plugins.lodash.cloneDeep(this._stringArray); + public getStringArray() { + const returnArray: string[] = []; + for (const stringItem of this._stringArray) { + returnArray.push(stringItem); + } + return returnArray; } // trigger registering @@ -88,7 +92,7 @@ export class Stringmap { /** * register a new trigger */ - registerUntilTrue(functionArg: ITriggerFunction, doFunctionArg) { + public registerUntilTrue(functionArg: ITriggerFunction, doFunctionArg) { this._triggerUntilTrueFunctionArray.push(() => { let result = functionArg(); if (result === true) { diff --git a/tslint.json b/tslint.json index 45052ad..d4ea2e9 100644 --- a/tslint.json +++ b/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" }