From ccce9dc04df309467c579799db470ad626b74a93 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 11 Mar 2018 16:44:32 +0100 Subject: [PATCH] update to latest standards --- .gitlab-ci.yml | 48 +++- defaults.yml | 4 - dist/index.d.ts | 1 + dist/index.js | 3 +- dist/smarttime.classes.hrtmeasurement.js | 6 +- dist/smarttime.classes.timer.d.ts | 37 +++ dist/smarttime.classes.timer.js | 46 ++++ dist/smarttime.classes.timestamp.d.ts | 18 +- dist/smarttime.classes.timestamp.js | 6 +- dist/smarttime.plugins.d.ts | 4 +- dist/smarttime.plugins.js | 5 +- dist/smarttime.units.js | 14 +- docs/index.md | 6 +- package.json | 8 +- readme.md | 6 +- test/test.timer.ts | 18 ++ test/test.ts | 55 +++-- ts/index.ts | 11 +- ts/smarttime.classes.hrtmeasurement.ts | 44 ++-- ts/smarttime.classes.timer.ts | 75 ++++++ ts/smarttime.classes.timestamp.ts | 92 +++---- ts/smarttime.plugins.ts | 9 +- ts/smarttime.units.ts | 61 +++-- tslint.json | 5 +- yarn.lock | 294 ++++++----------------- 25 files changed, 477 insertions(+), 399 deletions(-) delete mode 100644 defaults.yml create mode 100644 dist/smarttime.classes.timer.d.ts create mode 100644 dist/smarttime.classes.timer.js create mode 100644 test/test.timer.ts create mode 100644 ts/smarttime.classes.timer.ts diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 56a2530..14931f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,53 +7,77 @@ cache: key: "$CI_BUILD_STAGE" stages: +- security - test - release - trigger - pages +mirror: + stage: security + script: + - npmci git mirror + tags: + - docker + +snyk: + stage: security + script: + - npmci command yarn global add snyk + - npmci command yarn install --ignore-scripts + - npmci command snyk test + tags: + - docker + testLEGACY: stage: test script: - - npmci test legacy + - npmci node install legacy + - npmci npm install + - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker + - docker allow_failure: true testLTS: stage: test script: - - npmci test lts + - npmci node install lts + - npmci npm install + - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker + - docker testSTABLE: stage: test script: - - npmci test stable + - npmci node install stable + - npmci npm install + - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker + - docker release: stage: release script: - - npmci publish + - npmci npm prepare + - npmci npm publish only: - - tags + - tags tags: - - docker + - docker trigger: stage: trigger script: - - npmci trigger + - npmci trigger only: - - tags + - tags tags: - - docker + - docker pages: image: hosttoday/ht-docker-node:npmci diff --git a/defaults.yml b/defaults.yml deleted file mode 100644 index 5f158cc..0000000 --- a/defaults.yml +++ /dev/null @@ -1,4 +0,0 @@ -module.name: smartmodule -module.description: a smart description -module.author: Lossless GmbH -module.license: MIT \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts index 38f3da4..f5ba5fc 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,4 +1,5 @@ export * from './smarttime.classes.hrtmeasurement'; +export * from './smarttime.classes.timer'; export * from './smarttime.classes.timestamp'; export * from './smarttime.units'; export { moment } from './smarttime.plugins'; diff --git a/dist/index.js b/dist/index.js index d1196f4..b4838cd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4,8 +4,9 @@ function __export(m) { } Object.defineProperty(exports, "__esModule", { value: true }); __export(require("./smarttime.classes.hrtmeasurement")); +__export(require("./smarttime.classes.timer")); __export(require("./smarttime.classes.timestamp")); __export(require("./smarttime.units")); var smarttime_plugins_1 = require("./smarttime.plugins"); exports.moment = smarttime_plugins_1.moment; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUVBLHdEQUFrRDtBQUNsRCxtREFBNkM7QUFDN0MsdUNBQWlDO0FBRWpDLHlEQUE0QztBQUFuQyxxQ0FBQSxNQUFNLENBQUEifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUVBLHdEQUFtRDtBQUNuRCwrQ0FBMEM7QUFDMUMsbURBQThDO0FBQzlDLHVDQUFrQztBQUVsQyx5REFBNkM7QUFBcEMscUNBQUEsTUFBTSxDQUFBIn0= \ No newline at end of file diff --git a/dist/smarttime.classes.hrtmeasurement.js b/dist/smarttime.classes.hrtmeasurement.js index a874f2b..925d886 100644 --- a/dist/smarttime.classes.hrtmeasurement.js +++ b/dist/smarttime.classes.hrtmeasurement.js @@ -24,11 +24,11 @@ class HrtMeasurement { */ stop() { if (this._started === false) { - console.log('Hasn\'t started yet'); + console.log("Hasn't started yet"); return; } this._hrTimeStopDiff = process.hrtime(this._hrTimeStart); - this.nanoSeconds = (this._hrTimeStopDiff[0] * 1e9) + this._hrTimeStopDiff[1]; + this.nanoSeconds = this._hrTimeStopDiff[0] * 1e9 + this._hrTimeStopDiff[1]; this.milliSeconds = this.nanoSeconds / 1000000; return this; } @@ -44,4 +44,4 @@ class HrtMeasurement { } } exports.HrtMeasurement = HrtMeasurement; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuaHJ0bWVhc3VyZW1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3Nlcy5ocnRtZWFzdXJlbWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFrQztBQUVsQzs7R0FFRztBQUNIO0lBQUE7UUFDRSxnQkFBVyxHQUFXLElBQUksQ0FBQTtRQUMxQixpQkFBWSxHQUFXLElBQUksQ0FBQTtRQUNuQixpQkF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UFXLEdBQUcsSUFBSSxDQUFDLGVBQWUsQ0FBQyxDQUFDLENBQUMsR0FBRyxHQUFHLEdBQUcsSUFBSSxDQUFDLGVBQWUsQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUMzRSxJQUFJLENBQUMsWUFBWSxHQUFHLElBQUksQ0FBQyxXQUFXLEdBQUcsT0FBTyxDQUFDO1FBQy9DLE1BQU0sQ0FBQyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxLQUFLO1FBQ0gsSUFBSSxDQUFDLFdBQVcsR0FBRyxJQUFJLENBQUM7UUFDeEIsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7UUFDekIsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7UUFDekIsSUFBSSxDQUFDLGVBQWUsR0FBRyxJQUFJLENBQUM7UUFDNUIsSUFBSSxDQUFDLFFBQVEsR0FBRyxLQUFLLENBQUM7SUFDeEIsQ0FBQztDQUNGO0FBdkNELHdDQXVDQyJ9 \ No newline at end of file diff --git a/dist/smarttime.classes.timer.d.ts b/dist/smarttime.classes.timer.d.ts new file mode 100644 index 0000000..be5e2e8 --- /dev/null +++ b/dist/smarttime.classes.timer.d.ts @@ -0,0 +1,37 @@ +import { TimeStamp } from './smarttime.classes.timestamp'; +export declare type TimerState = 'initiated' | 'started' | 'paused' | 'completed'; +export declare class Timer { + /** + * the original amount of milliseconds for this Timer + */ + timeInMilliseconds: number; + /** + * the state of the timer + */ + state: TimerState; + /** + * completed Promise + */ + completed: Promise; + /** + * a reference to when the Timeout started + */ + startedAt: TimeStamp; + /** + * a reference to when a Timer has been potentially paused + */ + pausedAt: TimeStamp; + readonly timeLeft: number; + /** + * the current timeout the needs to be canceled when this Timer is stopped + */ + private currentTimeout; + private completedDeferred; + constructor(timeInMillisecondsArg: number); + /** + * starts the timer + */ + start(): void; + pause(): void; + resume(): void; +} diff --git a/dist/smarttime.classes.timer.js b/dist/smarttime.classes.timer.js new file mode 100644 index 0000000..12c2d04 --- /dev/null +++ b/dist/smarttime.classes.timer.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const plugins = require("./smarttime.plugins"); +const smarttime_classes_timestamp_1 = require("./smarttime.classes.timestamp"); +class Timer { + constructor(timeInMillisecondsArg) { + /** + * the state of the timer + */ + this.state = 'initiated'; + // a deferred triggeted when Timer has completed + this.completedDeferred = plugins.smartq.defer(); + this.timeInMilliseconds = timeInMillisecondsArg; + this.completed = this.completedDeferred.promise; + } + get timeLeft() { + return this.timeInMilliseconds - this.pausedAt.change; + } + /** + * starts the timer + */ + start() { + if (!this.startedAt) { + this.currentTimeout = setTimeout(() => { + this.completedDeferred.resolve(); + }, this.timeInMilliseconds); + this.startedAt = new smarttime_classes_timestamp_1.TimeStamp(); + } + else { + throw new Error('timer has been started before. Please use resume instead'); + } + } + pause() { + clearTimeout(this.currentTimeout); + this.pausedAt = smarttime_classes_timestamp_1.TimeStamp.fromTimeStamp(this.startedAt); + } + resume() { + if (this.startedAt) { + this.currentTimeout = setTimeout(() => { + this.completedDeferred.resolve(); + }, this.timeLeft); + } + } +} +exports.Timer = Timer; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMudGltZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3Nlcy50aW1lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtDQUErQztBQUUvQywrRUFBMEQ7QUFJMUQ7SUFxQ0UsWUFBWSxxQkFBNkI7UUEvQnpDOztXQUVHO1FBQ0ksVUFBSyxHQUFlLFdBQVcsQ0FBQztRQXlCdkMsZ0RBQWdEO1FBQ3hDLHNCQUFpQixHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFRLENBQUM7UUFHdkQsSUFBSSxD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cEMsSUFBSSxDQUFDLGlCQUFpQixDQUFDLE9BQU8sRUFBRSxDQUFDO1lBQ25DLENBQUMsRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDcEIsQ0FBQztJQUNILENBQUM7Q0FDRjtBQXBFRCxzQkFvRUMifQ== \ No newline at end of file diff --git a/dist/smarttime.classes.timestamp.d.ts b/dist/smarttime.classes.timestamp.d.ts index d016af9..274a366 100644 --- a/dist/smarttime.classes.timestamp.d.ts +++ b/dist/smarttime.classes.timestamp.d.ts @@ -3,6 +3,15 @@ * smart timestamp */ export declare class TimeStamp { + /** + * returns new TimeStamp from milliseconds + */ + static fromMilliSeconds(milliSecondsArg: any): TimeStamp; + /** + * returns new TimeStamp for now with change set + * @param timeStampArg + */ + static fromTimeStamp(timeStampArg: TimeStamp): TimeStamp; /** * The standard JavaScript Date */ @@ -21,15 +30,6 @@ export declare class TimeStamp { */ change: number; constructor(creatorArg?: number); - /** - * returns new TimeStamp from milliseconds - */ - static fromMilliSeconds(milliSecondsArg: any): TimeStamp; - /** - * returns new TimeStamp for now with change set - * @param timeStampArg - */ - static fromTimeStamp(timeStampArg: TimeStamp): TimeStamp; /** * Is the current instance older than the argument * @param TimeStampArg diff --git a/dist/smarttime.classes.timestamp.js b/dist/smarttime.classes.timestamp.js index 832516e..2fdbc47 100644 --- a/dist/smarttime.classes.timestamp.js +++ b/dist/smarttime.classes.timestamp.js @@ -39,7 +39,7 @@ class TimeStamp { * @param TimeStampArg */ isOlderThan(TimeStampArg, tresholdTimeArg = 0) { - if ((this.milliSeconds + tresholdTimeArg) < TimeStampArg.milliSeconds) { + if (this.milliSeconds + tresholdTimeArg < TimeStampArg.milliSeconds) { return true; } else { @@ -47,7 +47,7 @@ class TimeStamp { } } isYoungerThan(TimeStampArg, tresholdTimeArg = 0) { - if (this.milliSeconds > (TimeStampArg.milliSeconds + tresholdTimeArg)) { + if (this.milliSeconds > TimeStampArg.milliSeconds + tresholdTimeArg) { return true; } else { @@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0Q7OztPQUdHO0lBQ0ksV0FBVyxDQUFDLFlBQXVCLEVBQUUsa0JBQTBCLENBQUM7UUFDckUsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLFlBQVksR0FBRyxlQUFlLEdBQUcsWUFBWSxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUM7WUFDcEUsTUFBTSxDQUFDLElBQUksQ0FBQztRQUNkLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNOLE1BQU0sQ0FBQyxLQUFLLENBQUM7UUFDZixDQUFDO0lBQ0gsQ0FBQztJQUVNLGFBQWEsQ0FBQyxZQUF1QixFQUFFLGtCQUEwQixDQUFDO1FBQ3ZFLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxZQUFZLEdBQUcsWUFBWSxDQUFDLFlBQVksR0FBRyxlQUFlLENBQUMsQ0FBQyxDQUFDO1lBQ3BFLE1BQU0sQ0FBQyxJQUFJLENBQUM7UUFDZCxDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDTixNQUFNLENBQUMsS0FBSyxDQUFDO1FBQ2YsQ0FBQztJQUNILENBQUM7Q0FDRjtBQXBFRCw4QkFvRUMifQ== \ No newline at end of file diff --git a/dist/smarttime.plugins.d.ts b/dist/smarttime.plugins.d.ts index 5af701a..8c651e9 100644 --- a/dist/smarttime.plugins.d.ts +++ b/dist/smarttime.plugins.d.ts @@ -1,3 +1,3 @@ -import 'typings-global'; import * as moment from 'moment'; -export { moment }; +import * as smartq from 'smartq'; +export { moment, smartq }; diff --git a/dist/smarttime.plugins.js b/dist/smarttime.plugins.js index b367207..a6bef23 100644 --- a/dist/smarttime.plugins.js +++ b/dist/smarttime.plugins.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -require("typings-global"); const moment = require("moment"); exports.moment = moment; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUV2QixpQ0FBZ0M7QUFHOUIsd0JBQU0ifQ== \ No newline at end of file +const smartq = require("smartq"); +exports.smartq = smartq; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlDQUFpQztBQUd4Qix3QkFBTTtBQUZmLGlDQUFpQztBQUVoQix3QkFBTSJ9 \ No newline at end of file diff --git a/dist/smarttime.units.js b/dist/smarttime.units.js index 2e40000..dab0558 100644 --- a/dist/smarttime.units.js +++ b/dist/smarttime.units.js @@ -2,19 +2,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.units = { years: (timesArg = 1) => { - return timesArg * 3.154e+10; + return timesArg * 3.154e10; }, months: (timesArg = 1) => { - return timesArg * 2.628e+9; + return timesArg * 2.628e9; }, weeks: (timesArg = 1) => { - return timesArg * 6.048e+8; + return timesArg * 6.048e8; }, days: (timesArg = 1) => { - return timesArg * 8.64e+7; + return timesArg * 8.64e7; }, hours: (timesArg = 1) => { - return timesArg * 3.6e+6; + return timesArg * 3.6e6; }, minutes: (timesArg = 1) => { return timesArg * 60000; @@ -22,7 +22,7 @@ exports.units = { }; exports.getMilliSecondsFromUnits = (combinationArg) => { let timeInMilliseconds = 0; - let addMilliSeconds = (milliSecondsArg) => { + let addMilliSeconds = milliSecondsArg => { timeInMilliseconds = timeInMilliseconds + milliSecondsArg; }; if (combinationArg.years) { @@ -45,4 +45,4 @@ exports.getMilliSecondsFromUnits = (combinationArg) => { } return timeInMilliseconds; }; -//# sourceMappingUR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FBSyxDQUFDLENBQUMsQ0FBQztJQUNyRCxDQUFDO0lBQ0QsRUFBRSxDQUFDLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7UUFDM0IsZUFBZSxDQUFDLGFBQUssQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7SUFDekQsQ0FBQztJQUVELE1BQU0sQ0FBQyxrQkFBa0IsQ0FBQztBQUM1QixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index fc83899..75f40f5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,13 +1,16 @@ # smarttime + handle timeformats in smart ways ## Availabililty + [![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smarttime) [![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smarttime) [![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smarttime) [![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smarttime/) ## Status for master + [![build status](https://GitLab.com/pushrocks/smarttime/badges/master/build.svg)](https://GitLab.com/pushrocks/smarttime/commits/master) [![coverage report](https://GitLab.com/pushrocks/smarttime/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smarttime/commits/master) [![npm downloads per month](https://img.shields.io/npm/dm/smarttime.svg)](https://www.npmjs.com/package/smarttime) @@ -19,11 +22,12 @@ handle timeformats in smart ways [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) ## Usage + Use TypeScript for best in class instellisense. For further information read the linked docs at the top of this README. > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) +> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) [![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) diff --git a/package.json b/package.json index 6903490..80bf20f 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,12 @@ "test": "(npmts)" }, "devDependencies": { - "tapbundle": "^1.0.13" + "@types/node": "^9.4.7", + "tapbundle": "^2.0.0" }, "dependencies": { - "moment": "^2.18.1", - "typings-global": "^1.0.16" + "moment": "^2.21.0", + "smartdelay": "^1.0.4", + "smartq": "^1.1.6" } } diff --git a/readme.md b/readme.md index fc83899..75f40f5 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,16 @@ # smarttime + handle timeformats in smart ways ## Availabililty + [![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smarttime) [![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smarttime) [![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smarttime) [![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smarttime/) ## Status for master + [![build status](https://GitLab.com/pushrocks/smarttime/badges/master/build.svg)](https://GitLab.com/pushrocks/smarttime/commits/master) [![coverage report](https://GitLab.com/pushrocks/smarttime/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smarttime/commits/master) [![npm downloads per month](https://img.shields.io/npm/dm/smarttime.svg)](https://www.npmjs.com/package/smarttime) @@ -19,11 +22,12 @@ handle timeformats in smart ways [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) ## Usage + Use TypeScript for best in class instellisense. For further information read the linked docs at the top of this README. > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) +> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) [![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) diff --git a/test/test.timer.ts b/test/test.timer.ts new file mode 100644 index 0000000..343f9db --- /dev/null +++ b/test/test.timer.ts @@ -0,0 +1,18 @@ +// tslint:disable-next-line:no-implicit-dependencies +import { expect, tap } from 'tapbundle'; + +import { Timer } from '../ts/index'; + +let testTimer: Timer; + +tap.test('should create a valid timer', async () => { + testTimer = new Timer(1000); + expect(testTimer).to.be.instanceof(Timer) +}) + +tap.test('should start timer', async () => { + testTimer.start() + await testTimer.completed; +}) + +tap.start() \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index 7576017..efb46a8 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,36 +1,35 @@ -import { expect, tap } from 'tapbundle' -import * as smarttime from '../ts/index' - +import { expect, tap } from 'tapbundle'; +import * as smarttime from '../ts/index'; // Test TimeStamp class -let testTimeStamp: smarttime.TimeStamp -let testTimeStamp2: smarttime.TimeStamp -tap.test('should create valid testTimeStamp instance', async (tools) => { - testTimeStamp = new smarttime.TimeStamp() - await tools.delayFor(2) - testTimeStamp2 = new smarttime.TimeStamp() - expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp) - expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp) -}) +let testTimeStamp: smarttime.TimeStamp; +let testTimeStamp2: smarttime.TimeStamp; +tap.test('should create valid testTimeStamp instance', async tools => { + testTimeStamp = new smarttime.TimeStamp(); + await tools.delayFor(2); + testTimeStamp2 = new smarttime.TimeStamp(); + expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp); + expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp); +}); tap.test('should have valid linuxtime', async () => { // tslint:disable-next-line:no-unused-expression - expect(testTimeStamp.isOlderThan(testTimeStamp2)).to.be.true + expect(testTimeStamp.isOlderThan(testTimeStamp2)).to.be.true; // tslint:disable-next-line:no-unused-expression - expect(testTimeStamp.isYoungerThan(testTimeStamp2)).to.be.false -}) + expect(testTimeStamp.isYoungerThan(testTimeStamp2)).to.be.false; +}); -let testHrtMeasurement: smarttime.HrtMeasurement +let testHrtMeasurement: smarttime.HrtMeasurement; // Test HrtMeasurement -tap.test('should create valid HrtMeasurements', async (tools) => { - testHrtMeasurement = new smarttime.HrtMeasurement() - testHrtMeasurement.start() - await tools.delayFor(20) - testHrtMeasurement.stop() - expect(testHrtMeasurement.milliSeconds).to.be.greaterThan(19) - expect(testHrtMeasurement.milliSeconds).to.be.lessThan(25) -}) +tap.test('should create valid HrtMeasurements', async tools => { + testHrtMeasurement = new smarttime.HrtMeasurement(); + testHrtMeasurement.start(); + await tools.delayFor(20); + testHrtMeasurement.stop(); + expect(testHrtMeasurement.milliSeconds).to.be.greaterThan(19); + expect(testHrtMeasurement.milliSeconds).to.be.lessThan(25); +}); // check units tap.test('should combine units', async () => { @@ -41,8 +40,8 @@ tap.test('should combine units', async () => { days: 2, hours: 2, minutes: 2 - }) - console.log(computedTime) -}) + }); + console.log(computedTime); +}); -tap.start() +tap.start(); diff --git a/ts/index.ts b/ts/index.ts index 694bbfb..e144c71 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,7 +1,8 @@ -import * as plugins from './smarttime.plugins' +import * as plugins from './smarttime.plugins'; -export * from './smarttime.classes.hrtmeasurement' -export * from './smarttime.classes.timestamp' -export * from './smarttime.units' +export * from './smarttime.classes.hrtmeasurement'; +export * from './smarttime.classes.timer'; +export * from './smarttime.classes.timestamp'; +export * from './smarttime.units'; -export { moment } from './smarttime.plugins' +export { moment } from './smarttime.plugins'; diff --git a/ts/smarttime.classes.hrtmeasurement.ts b/ts/smarttime.classes.hrtmeasurement.ts index e421710..190f4db 100644 --- a/ts/smarttime.classes.hrtmeasurement.ts +++ b/ts/smarttime.classes.hrtmeasurement.ts @@ -1,45 +1,45 @@ -import * as process from 'process' +import * as process from 'process'; /** * easy high resolution time measurement */ export class HrtMeasurement { - nanoSeconds: number = null - milliSeconds: number = null - private _hrTimeStart = null - private _hrTimeStopDiff = null - private _started: boolean = false + nanoSeconds: number = null; + milliSeconds: number = null; + private _hrTimeStart = null; + private _hrTimeStopDiff = null; + private _started: boolean = false; /** * start the measurement */ - start () { - this._started = true - this._hrTimeStart = process.hrtime() + start() { + this._started = true; + this._hrTimeStart = process.hrtime(); } /** * stop the measurement */ - stop () { + stop() { if (this._started === false) { - console.log('Hasn\'t started yet') - return + console.log("Hasn't started yet"); + return; } - this._hrTimeStopDiff = process.hrtime(this._hrTimeStart) - this.nanoSeconds = (this._hrTimeStopDiff[0] * 1e9) + this._hrTimeStopDiff[1] - this.milliSeconds = this.nanoSeconds / 1000000 - return this + this._hrTimeStopDiff = process.hrtime(this._hrTimeStart); + this.nanoSeconds = this._hrTimeStopDiff[0] * 1e9 + this._hrTimeStopDiff[1]; + this.milliSeconds = this.nanoSeconds / 1000000; + return this; } /** * reset the measurement */ - reset () { - this.nanoSeconds = null - this.milliSeconds = null - this._hrTimeStart = null - this._hrTimeStopDiff = null - this._started = false + reset() { + this.nanoSeconds = null; + this.milliSeconds = null; + this._hrTimeStart = null; + this._hrTimeStopDiff = null; + this._started = false; } } diff --git a/ts/smarttime.classes.timer.ts b/ts/smarttime.classes.timer.ts new file mode 100644 index 0000000..247429e --- /dev/null +++ b/ts/smarttime.classes.timer.ts @@ -0,0 +1,75 @@ +import * as plugins from './smarttime.plugins'; + +import { TimeStamp } from './smarttime.classes.timestamp'; + +export type TimerState = 'initiated' | 'started' | 'paused' | 'completed'; + +export class Timer { + /** + * the original amount of milliseconds for this Timer + */ + public timeInMilliseconds: number; + + /** + * the state of the timer + */ + public state: TimerState = 'initiated'; + + /** + * completed Promise + */ + public completed: Promise; + + /** + * a reference to when the Timeout started + */ + public startedAt: TimeStamp; + + /** + * a reference to when a Timer has been potentially paused + */ + public pausedAt: TimeStamp; + + get timeLeft(): number { + return this.timeInMilliseconds - this.pausedAt.change; + } + /** + * the current timeout the needs to be canceled when this Timer is stopped + */ + private currentTimeout: NodeJS.Timer; + + // a deferred triggeted when Timer has completed + private completedDeferred = plugins.smartq.defer(); + + constructor(timeInMillisecondsArg: number) { + this.timeInMilliseconds = timeInMillisecondsArg; + this.completed = this.completedDeferred.promise; + } + + /** + * starts the timer + */ + public start() { + if (!this.startedAt) { + this.currentTimeout = setTimeout(() => { + this.completedDeferred.resolve(); + }, this.timeInMilliseconds); + this.startedAt = new TimeStamp(); + } else { + throw new Error('timer has been started before. Please use resume instead'); + } + } + + public pause() { + clearTimeout(this.currentTimeout); + this.pausedAt = TimeStamp.fromTimeStamp(this.startedAt); + } + + public resume() { + if (this.startedAt) { + this.currentTimeout = setTimeout(() => { + this.completedDeferred.resolve(); + }, this.timeLeft); + } + } +} diff --git a/ts/smarttime.classes.timestamp.ts b/ts/smarttime.classes.timestamp.ts index dc35237..7607b98 100644 --- a/ts/smarttime.classes.timestamp.ts +++ b/ts/smarttime.classes.timestamp.ts @@ -1,75 +1,75 @@ -import * as plugins from './smarttime.plugins' +import * as plugins from './smarttime.plugins'; /** * TimeStamp * smart timestamp */ export class TimeStamp { - /** - * The standard JavaScript Date - */ - date: Date - - /** - * The time as linux time (milliseconds, not seconds though) - * good for comparison - */ - milliSeconds: number - - /** - * The standard epoch time in seconds - */ - epochtime: number - - /** - * if derived from another TimeStamp points out the change in milliseconds - */ - change: number = null - - constructor (creatorArg?: number) { - if (!creatorArg) { - this.date = new Date() - } else if (typeof creatorArg === 'number') { - this.date = new Date(creatorArg) - } - this.milliSeconds = this.date.getTime() - this.epochtime = Math.floor(this.milliSeconds / 1000) - } - /** * returns new TimeStamp from milliseconds */ - static fromMilliSeconds (milliSecondsArg) { - return new TimeStamp(milliSecondsArg) + public static fromMilliSeconds(milliSecondsArg) { + return new TimeStamp(milliSecondsArg); } /** * returns new TimeStamp for now with change set * @param timeStampArg */ - static fromTimeStamp (timeStampArg: TimeStamp) { - let localTimeStamp = new TimeStamp() - localTimeStamp.change = localTimeStamp.milliSeconds - timeStampArg.milliSeconds - return localTimeStamp + public static fromTimeStamp(timeStampArg: TimeStamp) { + const localTimeStamp = new TimeStamp(); + localTimeStamp.change = localTimeStamp.milliSeconds - timeStampArg.milliSeconds; + return localTimeStamp; + } + + /** + * The standard JavaScript Date + */ + public date: Date; + + /** + * The time as linux time (milliseconds, not seconds though) + * good for comparison + */ + public milliSeconds: number; + + /** + * The standard epoch time in seconds + */ + public epochtime: number; + + /** + * if derived from another TimeStamp points out the change in milliseconds + */ + public change: number = null; + + constructor(creatorArg?: number) { + if (!creatorArg) { + this.date = new Date(); + } else if (typeof creatorArg === 'number') { + this.date = new Date(creatorArg); + } + this.milliSeconds = this.date.getTime(); + this.epochtime = Math.floor(this.milliSeconds / 1000); } /** * Is the current instance older than the argument * @param TimeStampArg */ - isOlderThan (TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) { - if ((this.milliSeconds + tresholdTimeArg) < TimeStampArg.milliSeconds) { - return true + public isOlderThan(TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) { + if (this.milliSeconds + tresholdTimeArg < TimeStampArg.milliSeconds) { + return true; } else { - return false + return false; } } - isYoungerThan (TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) { - if (this.milliSeconds > (TimeStampArg.milliSeconds + tresholdTimeArg)) { - return true + public isYoungerThan(TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) { + if (this.milliSeconds > TimeStampArg.milliSeconds + tresholdTimeArg) { + return true; } else { - return false + return false; } } } diff --git a/ts/smarttime.plugins.ts b/ts/smarttime.plugins.ts index b612f3c..75217d1 100644 --- a/ts/smarttime.plugins.ts +++ b/ts/smarttime.plugins.ts @@ -1,7 +1,4 @@ -import 'typings-global' +import * as moment from 'moment'; +import * as smartq from 'smartq'; -import * as moment from 'moment' - -export { - moment -} +export { moment, smartq }; diff --git a/ts/smarttime.units.ts b/ts/smarttime.units.ts index bfdbbb0..8216260 100644 --- a/ts/smarttime.units.ts +++ b/ts/smarttime.units.ts @@ -1,45 +1,56 @@ export let units = { years: (timesArg = 1): number => { - return timesArg * 3.154e+10 + return timesArg * 3.154e10; }, months: (timesArg = 1): number => { - return timesArg * 2.628e+9 + return timesArg * 2.628e9; }, weeks: (timesArg = 1) => { - return timesArg * 6.048e+8 + return timesArg * 6.048e8; }, days: (timesArg = 1) => { - return timesArg * 8.64e+7 + return timesArg * 8.64e7; }, hours: (timesArg = 1) => { - return timesArg * 3.6e+6 + return timesArg * 3.6e6; }, minutes: (timesArg = 1) => { - return timesArg * 60000 + return timesArg * 60000; } -} +}; export interface IUnitCombinationArg { - years?: number - months?: number - weeks?: number - days?: number - hours?: number - minutes?: number + years?: number; + months?: number; + weeks?: number; + days?: number; + hours?: number; + minutes?: number; } export let getMilliSecondsFromUnits = (combinationArg: IUnitCombinationArg) => { - let timeInMilliseconds = 0 - let addMilliSeconds = (milliSecondsArg) => { - timeInMilliseconds = timeInMilliseconds + milliSecondsArg + let timeInMilliseconds = 0; + let addMilliSeconds = milliSecondsArg => { + timeInMilliseconds = timeInMilliseconds + milliSecondsArg; + }; + if (combinationArg.years) { + addMilliSeconds(units.years(combinationArg.years)); + } + if (combinationArg.months) { + addMilliSeconds(units.months(combinationArg.months)); + } + if (combinationArg.weeks) { + addMilliSeconds(units.weeks(combinationArg.weeks)); + } + if (combinationArg.days) { + addMilliSeconds(units.days(combinationArg.days)); + } + if (combinationArg.hours) { + addMilliSeconds(units.hours(combinationArg.hours)); + } + if (combinationArg.minutes) { + addMilliSeconds(units.minutes(combinationArg.minutes)); } - if (combinationArg.years) { addMilliSeconds(units.years(combinationArg.years)) } - if (combinationArg.months) { addMilliSeconds(units.months(combinationArg.months)) } - if (combinationArg.weeks) { addMilliSeconds(units.weeks(combinationArg.weeks)) } - if (combinationArg.days) { addMilliSeconds(units.days(combinationArg.days)) } - if (combinationArg.hours) { addMilliSeconds(units.hours(combinationArg.hours)) } - if (combinationArg.minutes) { addMilliSeconds(units.minutes(combinationArg.minutes)) } - - return timeInMilliseconds -} + return timeInMilliseconds; +}; diff --git a/tslint.json b/tslint.json index 45052ad..364f009 100644 --- a/tslint.json +++ b/tslint.json @@ -1,3 +1,6 @@ { - "extends": "tslint-config-standard" + "extends": [ + "tslint:latest", + "tslint-config-prettier" + ] } diff --git a/yarn.lock b/yarn.lock index 47268f1..42a405b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,72 +2,37 @@ # yarn lockfile v1 -"@types/chai-as-promised@0.0.29": - version "0.0.29" - resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77" - dependencies: - "@types/chai" "*" - "@types/promises-a-plus" "*" - -"@types/chai-string@^1.1.30": - version "1.1.30" - resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a" +"@types/chai-as-promised@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.0.tgz#010b04cde78eacfb6e72bfddb3e58fe23c2e78b9" dependencies: "@types/chai" "*" -"@types/chai@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.3.tgz#6c2264b195cd2bb4c95c108487e13df0c8567c3e" - -"@types/chai@^3.4.35": - version "3.5.2" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e" - -"@types/glob@*": - version "5.0.30" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.30.tgz#1026409c5625a8689074602808d082b2867b8a51" +"@types/chai-string@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.4.0.tgz#c8b78deb9ae53e86c05a446c256138faeaff53c1" dependencies: - "@types/minimatch" "*" - "@types/node" "*" + "@types/chai" "*" -"@types/minimatch@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.0.tgz#a8b68c324817169b6004b432a598478a5d8f025a" +"@types/chai@*", "@types/chai@^4.1.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.2.tgz#f1af664769cfb50af805431c407425ed619daa21" -"@types/node@*": - version "8.0.22" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.22.tgz#9c6bfee1f45f5e9952ff6b487e657ecca48c7777" - -"@types/promises-a-plus@*": - version "0.0.27" - resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780" - -"@types/shelljs@^0.7.2": - version "0.7.4" - resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc" - dependencies: - "@types/glob" "*" - "@types/node" "*" - -"@types/which@^1.0.28": - version "1.0.28" - resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6" +"@types/node@^9.4.7": + version "9.4.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.7.tgz#57d81cd98719df2c9de118f2d5f3b1120dcd7275" ansi-256-colors@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a" assertion-error@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" beautycolor@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c" + version "1.0.11" + resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5" dependencies: ansi-256-colors "^1.1.0" typings-global "^1.0.14" @@ -76,44 +41,36 @@ bindings@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7" -brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -chai-as-promised@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6" +chai-as-promised@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0" dependencies: check-error "^1.0.2" -chai-string@^1.3.0: +chai-string@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49" -chai@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247" +chai@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c" dependencies: assertion-error "^1.0.1" - deep-eql "^0.1.3" - type-detect "^1.0.0" + check-error "^1.0.1" + deep-eql "^3.0.0" + get-func-name "^2.0.0" + pathval "^1.0.0" + type-detect "^4.0.0" -check-error@^1.0.2: +check-error@^1.0.1, check-error@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -deep-eql@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" +deep-eql@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" dependencies: - type-detect "0.1.1" + type-detect "^4.0.0" define-properties@^1.1.2: version "1.1.2" @@ -131,11 +88,11 @@ early@^2.1.1: typings-global "^1.0.16" es-abstract@^1.5.1: - version "1.8.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.8.0.tgz#3b00385e85729932beffa9163bbea1234e932914" + version "1.10.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864" dependencies: es-to-primitive "^1.1.1" - function-bind "^1.1.0" + function-bind "^1.1.1" has "^1.0.1" is-callable "^1.1.3" is-regex "^1.0.4" @@ -149,31 +106,20 @@ es-to-primitive@^1.1.1: is-symbol "^1.0.1" es6-error@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98" + version "4.1.1" + resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d" foreach@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" +function-bind@^1.0.2, function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" -function-bind@^1.0.2, function-bind@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" - -glob@^7.0.0: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - 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" +get-func-name@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" has@^1.0.1: version "1.0.1" @@ -181,21 +127,6 @@ has@^1.0.1: dependencies: function-bind "^1.0.2" -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.3" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" - is-callable@^1.1.1, is-callable@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" @@ -214,10 +145,6 @@ is-symbol@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - leakage@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39" @@ -229,8 +156,8 @@ leakage@^0.3.0: pretty-bytes "^4.0.2" left-pad@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a" + version "1.2.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee" memwatch-next@^0.3.0: version "0.3.0" @@ -239,23 +166,17 @@ memwatch-next@^0.3.0: bindings "^1.2.1" nan "^2.3.2" -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -moment@^2.18.1: - version "2.18.1" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f" +moment@^2.21.0: + version "2.21.0" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.21.0.tgz#2a114b51d2a6ec9e6d83cf803f838a878d8a023a" nan@^2.3.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" + version "2.9.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866" object-keys@^1.0.8: version "1.0.11" @@ -268,62 +189,28 @@ object.getownpropertydescriptors@^2.0.3: define-properties "^1.1.2" es-abstract "^1.5.1" -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" +pathval@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0" pretty-bytes@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9" -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" +smartchai@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-2.0.1.tgz#d20f17221f0e3c6c3473600b78ddfba0ab0ea762" dependencies: - resolve "^1.1.6" + "@types/chai" "^4.1.2" + "@types/chai-as-promised" "^7.1.0" + "@types/chai-string" "^1.4.0" + chai "^4.1.2" + chai-as-promised "^7.1.1" + chai-string "^1.4.0" -resolve@^1.1.6: - version "1.4.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" - dependencies: - path-parse "^1.0.5" - -semver@^5.3.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" - -shelljs@^0.7.8: - version "0.7.8" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -smartchai@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f" - dependencies: - "@types/chai" "^3.4.35" - "@types/chai-as-promised" "0.0.29" - "@types/chai-string" "^1.1.30" - chai "^3.5.0" - chai-as-promised "^6.0.0" - chai-string "^1.3.0" - -smartdelay@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579" +smartdelay@^1.0.3, smartdelay@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.4.tgz#791c1a4ee6770494064c10b1d2d2b8e6f3105b82" dependencies: smartq "^1.1.1" typings-global "^1.0.16" @@ -335,42 +222,23 @@ smartq@^1.1.1, smartq@^1.1.6: typings-global "^1.0.19" util.promisify "^1.0.0" -smartshell@^1.0.6: - version "1.0.13" - resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.13.tgz#277b34e6624df70003e0e3a6c900cd5ebab7eb92" - dependencies: - "@types/shelljs" "^0.7.2" - "@types/which" "^1.0.28" - shelljs "^0.7.8" - smartq "^1.1.6" - typings-global "^1.0.19" - which "^1.2.14" - -tapbundle@^1.0.13: - version "1.1.1" - resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.1.tgz#ec4172c0e82a77b1f6133fef2606311ede28a62d" +tapbundle@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-2.0.0.tgz#79fce68ff185c786fabaf6eb589a4afc7d2714b7" dependencies: early "^2.1.1" leakage "^0.3.0" - smartchai "^1.0.3" + smartchai "^2.0.0" smartdelay "^1.0.3" smartq "^1.1.1" - typings-global "^1.0.19" -type-detect@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" - -type-detect@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" +type-detect@^4.0.0: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19: - version "1.0.20" - resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.20.tgz#3da769c54db538247c5d877d1d9e97eb2ec981ff" - dependencies: - semver "^5.3.0" - smartshell "^1.0.6" + version "1.0.28" + resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.28.tgz#e28cc965476564cbc00e438739e0aa0735d323d4" util.promisify@^1.0.0: version "1.0.0" @@ -378,13 +246,3 @@ util.promisify@^1.0.0: dependencies: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" - -which@^1.2.14: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" - dependencies: - isexe "^2.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"