Compare commits

...

53 Commits

Author SHA1 Message Date
0c0b08e2be 3.0.13 2020-05-25 21:45:44 +00:00
dd722146f4 fix(core): update 2020-05-25 21:45:43 +00:00
c968e156ae 3.0.12 2019-06-18 14:45:07 +02:00
b5509711e7 fix(core): update 2019-06-18 14:45:07 +02:00
f8540b8076 3.0.11 2019-06-18 14:38:57 +02:00
30d18db4af fix(core): update 2019-06-18 14:38:57 +02:00
388649659c 3.0.10 2019-06-18 11:58:36 +02:00
e8ff289a9a fix(core): update 2019-06-18 11:58:36 +02:00
a5deb25bfb 3.0.9 2019-06-17 17:19:55 +02:00
ce2d1b278b fix(core): update 2019-06-17 17:19:54 +02:00
aa16e5d5bb 3.0.8 2019-06-17 16:54:39 +02:00
f221e9c0fa fix(core): update 2019-06-17 16:54:39 +02:00
9935396f2d 3.0.7 2019-04-10 14:37:39 +02:00
1bc379daa5 3.0.6 2019-04-10 14:06:21 +02:00
f9b81fc801 fix(core): update 2019-04-10 14:06:20 +02:00
6d8e39f11b 3.0.6 2019-04-10 11:34:30 +02:00
cff5b5a7f4 fix(core): update 2019-04-10 11:34:30 +02:00
f6be9b71f1 3.0.5 2018-11-23 19:26:42 +01:00
9c2d584170 fix(core): update 2018-11-23 19:26:41 +01:00
10bff069c1 3.0.4 2018-11-23 18:48:08 +01:00
8f6272eca4 fix(core): update 2018-11-23 18:48:07 +01:00
f02df7789c 3.0.3 2018-11-23 18:29:38 +01:00
d720b8b084 fix(core): update 2018-11-23 18:29:38 +01:00
6bca8557f9 3.0.2 2018-10-21 17:32:03 +02:00
f0a5e18335 fix(ExtendedDate): now respects single digit dates 2018-10-21 17:32:03 +02:00
57fbdb4a70 update 2018-10-21 17:23:58 +02:00
4a56527f7d 3.0.1 2018-10-21 12:12:45 +02:00
2a14d928a8 fix(date): now supports date and time 2018-10-21 12:12:44 +02:00
f161f71c4e 3.0.0 2018-10-17 01:42:36 +02:00
ed1f79caa4 BREAKING CHANGE(deps): remove moment and use luxon 2018-10-17 01:42:36 +02:00
539bbc1568 2.0.2 2018-07-13 00:03:08 +02:00
7d4bf05289 fix(dependencies): leaner dependencies 2018-07-13 00:03:08 +02:00
46cbb082fd 2.0.1 2018-06-10 14:00:18 +02:00
874349ba32 fix(core): update and change scope 2018-06-10 14:00:18 +02:00
69fee8f8a2 update test 2018-03-12 00:13:17 +01:00
527bad8e0a 2.0.0 2018-03-11 18:21:18 +01:00
4c87caedfe add better younger comperator for millisenconds 2018-03-11 18:20:33 +01:00
526771d1df 1.0.12 2018-03-11 17:06:30 +01:00
1e99734da7 update ci 2018-03-11 17:06:26 +01:00
e85c6005dc 1.0.11 2018-03-11 16:44:34 +01:00
ccce9dc04d update to latest standards 2018-03-11 16:44:32 +01:00
0dc3c1af46 1.0.10 2017-08-21 14:29:02 +02:00
d227d857b4 add moment 2017-08-21 14:28:59 +02:00
ca6367686e 1.0.9 2017-08-20 00:39:24 +02:00
0651c16222 fix units 2017-08-20 00:39:20 +02:00
4b891b196b 1.0.8 2017-08-20 00:33:47 +02:00
d7902694c8 fix units 2017-08-20 00:33:43 +02:00
7825085db4 1.0.7 2017-08-19 18:00:00 +02:00
0d34554fab update treshold computation 2017-08-19 17:59:54 +02:00
73b1002451 1.0.6 2017-08-16 16:43:47 +02:00
824e055cbd .isOlderThan() and .isYoungerThan now support compareTimeArg 2017-08-16 16:43:44 +02:00
633ec0606b 1.0.5 2017-08-16 16:24:59 +02:00
d9dd881e6e add unit computation 2017-08-16 16:24:56 +02:00
52 changed files with 20953 additions and 703 deletions

19
.gitignore vendored
View File

@ -1,5 +1,22 @@
.nogit/
node_modules/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_web/
dist_serve/
dist_ts_web/
# custom

View File

@ -1,71 +1,117 @@
# gitzone standard
# gitzone ci_default
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- pages
- metadata
testLEGACY:
stage: test
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
- npmci git mirror
tags:
- docker
allow_failure: true
- docker
- 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:
stage: test
script:
- npmci test lts
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci test stable
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- docker
- notpriv
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- 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:
stage: trigger
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- docker
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
stage: metadata
script:
- npmci command yarn global add npmpage
- npmci command npmpage
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

View File

@ -1,4 +0,0 @@
module.name: smartmodule
module.description: a smart description
module.author: Lossless GmbH
module.license: MIT

2
dist/index.d.ts vendored
View File

@ -1,2 +0,0 @@
export * from './smarttime.classes.hrtmeasurement';
export * from './smarttime.classes.timestamp';

8
dist/index.js vendored
View File

@ -1,8 +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 });
__export(require("./smarttime.classes.hrtmeasurement"));
__export(require("./smarttime.classes.timestamp"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUVBLHdEQUFrRDtBQUNsRCxtREFBNkMifQ==

View File

@ -1,47 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const process = require("process");
/**
* easy high resolution time measurement
*/
class HrtMeasurement {
constructor() {
this.nanoSeconds = null;
this.milliSeconds = null;
this._hrTimeStart = null;
this._hrTimeStopDiff = null;
this._started = false;
}
/**
* start the measurement
*/
start() {
this._started = true;
this._hrTimeStart = process.hrtime();
}
/**
* stop the measurement
*/
stop() {
if (this._started === false) {
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;
}
/**
* reset the measurement
*/
reset() {
this.nanoSeconds = null;
this.milliSeconds = null;
this._hrTimeStart = null;
this._hrTimeStopDiff = null;
this._started = false;
}
}
exports.HrtMeasurement = HrtMeasurement;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuaHJ0bWVhc3VyZW1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3Nlcy5ocnRtZWFzdXJlbWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFrQztBQUVsQzs7R0FFRztBQUNIO0lBQUE7UUFDRSxnQkFBVyxHQUFXLElBQUksQ0FBQTtRQUMxQixpQkFB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O1FBQ3hCLElBQUksQ0FBQyxlQUFlLEdBQUcsSUFBSSxDQUFBO1FBQzNCLElBQUksQ0FBQyxRQUFRLEdBQUcsS0FBSyxDQUFBO0lBQ3ZCLENBQUM7Q0FDRjtBQXZDRCx3Q0F1Q0MifQ==

View File

@ -1,59 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* TimeStamp
* smart timestamp
*/
class TimeStamp {
constructor(creatorArg) {
/**
* if derived from another TimeStamp points out the change in milliseconds
*/
this.change = null;
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);
}
/**
* returns new TimeStamp for now with change set
* @param timeStampArg
*/
static fromTimeStamp(timeStampArg) {
let localTimeStamp = new TimeStamp();
localTimeStamp.change = localTimeStamp.milliSeconds - timeStampArg.milliSeconds;
return localTimeStamp;
}
/**
* Is the current instance older than the argument
* @param TimeStampArg
*/
isOlderThan(TimeStampArg) {
if (this.milliSeconds < TimeStampArg.milliSeconds) {
return true;
}
else {
return false;
}
}
isYoungerThan(TimeStampArg) {
if (this.milliSeconds > TimeStampArg.milliSeconds) {
return true;
}
else {
return false;
}
}
}
exports.TimeStamp = TimeStamp;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMudGltZXN0YW1wLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR0aW1lLmNsYXNzZXMudGltZXN0YW1wLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUE7OztHQUdHO0FBQ0g7SUFzQkUsWUFBYSxVQUFtQjtRQUxoQzs7V0FFRztRQUNILFdBQU0sR0FBVyxJQUFJL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BQUMsQ0FBQyxDQUFDO1lBQ2xELE1BQU0sQ0FBQyxJQUFJLENBQUE7UUFDYixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDTixNQUFNLENBQUMsS0FBSyxDQUFBO1FBQ2QsQ0FBQztJQUNILENBQUM7SUFFRCxhQUFhLENBQUUsWUFBdUI7UUFDcEMsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLFlBQVksR0FBRyxZQUFZLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUNsRCxNQUFNLENBQUMsSUFBSSxDQUFBO1FBQ2IsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ04sTUFBTSxDQUFDLEtBQUssQ0FBQTtRQUNkLENBQUM7SUFDSCxDQUFDO0NBQ0Y7QUFwRUQsOEJBb0VDIn0=

View File

@ -1 +0,0 @@
import 'typings-global';

View File

@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QiJ9

16120
dist_bundle/bundle.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
dist_ts/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export * from './smarttime.classes.cronmanager';
export * from './smarttime.classes.extendeddate';
export * from './smarttime.classes.hrtmeasurement';
export * from './smarttime.classes.timer';
export * from './smarttime.classes.timestamp';
export * from './smarttime.units';
export { luxon } from './smarttime.plugins';

21
dist_ts/index.js Normal file
View File

@ -0,0 +1,21 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./smarttime.classes.cronmanager"), exports);
__exportStar(require("./smarttime.classes.extendeddate"), exports);
__exportStar(require("./smarttime.classes.hrtmeasurement"), exports);
__exportStar(require("./smarttime.classes.timer"), exports);
__exportStar(require("./smarttime.classes.timestamp"), exports);
__exportStar(require("./smarttime.units"), exports);
var smarttime_plugins_1 = require("./smarttime.plugins");
Object.defineProperty(exports, "luxon", { enumerable: true, get: function () { return smarttime_plugins_1.luxon; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFFQSxrRUFBZ0Q7QUFDaEQsbUVBQWlEO0FBQ2pELHFFQUFtRDtBQUNuRCw0REFBMEM7QUFDMUMsZ0VBQThDO0FBQzlDLG9EQUFrQztBQUVsQyx5REFBNEM7QUFBbkMsMEdBQUEsS0FBSyxPQUFBIn0=

17
dist_ts/smarttime.classes.cronjob.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
import { CronManager } from './smarttime.classes.cronmanager';
export declare type TJobFunction = (() => void) | (() => Promise<any>);
export declare class CronJob {
status: 'started' | 'stopped' | 'initial';
cronExpression: string;
jobFunction: TJobFunction;
private cronInterval;
private nextExecutionUnix;
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction);
/**
* checks wether the cronjob needs to be executed
*/
checkExecution(): void;
start(): void;
stop(): void;
private getCronInterval;
}

View File

@ -0,0 +1,57 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CronJob = void 0;
const plugins = __importStar(require("./smarttime.plugins"));
class CronJob {
constructor(cronManager, cronExpressionArg, jobFunction) {
this.status = 'initial';
this.cronInterval = plugins.cronParser.parseExpression('* * * * * *');
this.nextExecutionUnix = 0;
this.cronExpression = cronExpressionArg;
this.jobFunction = jobFunction;
}
/**
* checks wether the cronjob needs to be executed
*/
checkExecution() {
if (this.nextExecutionUnix === 0) {
this.nextExecutionUnix = this.cronInterval.next().toDate().getTime();
return;
}
if (Date.now() > this.nextExecutionUnix) {
this.jobFunction();
this.nextExecutionUnix = this.cronInterval.next().toDate().getTime();
}
}
start() {
this.cronInterval = this.getCronInterval();
this.status = 'started';
}
stop() {
this.status = 'stopped';
}
getCronInterval() {
return plugins.cronParser.parseExpression(this.cronExpression);
}
}
exports.CronJob = CronJob;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuY3JvbmpvYi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0dGltZS5jbGFzc2VzLmNyb25qb2IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7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0FBQztJQUMxQixDQUFDO0lBRU8sZUFBZTtRQUNyQixPQUFPLE9BQU8sQ0FBQyxVQUFVLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUNqRSxDQUFDO0NBQ0Y7QUF2Q0QsMEJBdUNDIn0=

View File

@ -0,0 +1,17 @@
import { CronJob } from './smarttime.classes.cronjob';
import { Interval } from './smarttime.classes.interval';
export declare class CronManager {
cronInterval: Interval;
status: 'started' | 'stopped';
cronjobs: CronJob[];
constructor();
addCronjob(cronIdentifierArg: string, cronFunctionArg: () => any): void;
/**
* starts the cronjob
*/
start(): void;
/**
* stops all cronjobs
*/
stop(): void;
}

View File

@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CronManager = void 0;
const smarttime_classes_cronjob_1 = require("./smarttime.classes.cronjob");
const smarttime_classes_interval_1 = require("./smarttime.classes.interval");
class CronManager {
constructor() {
this.cronInterval = new smarttime_classes_interval_1.Interval(1000);
this.status = 'stopped';
this.cronjobs = [];
this.cronInterval.addIntervalJob(() => {
for (const cronJob of this.cronjobs) {
cronJob.checkExecution();
}
});
}
addCronjob(cronIdentifierArg, cronFunctionArg) {
const newCronJob = new smarttime_classes_cronjob_1.CronJob(this, cronIdentifierArg, cronFunctionArg);
this.cronjobs.push(newCronJob);
if (this.status === 'started') {
newCronJob.start();
}
}
/**
* starts the cronjob
*/
start() {
this.status = 'started';
for (const cron of this.cronjobs) {
cron.start();
}
this.cronInterval.start();
}
/**
* stops all cronjobs
*/
stop() {
this.status = 'stopped';
for (const cron of this.cronjobs) {
cron.stop();
}
this.cronInterval.stop();
}
}
exports.CronManager = CronManager;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuY3Jvbm1hbmFnZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3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1QixDQUFDO0lBRUQ7O09BRUc7SUFDSSxJQUFJO1FBQ1QsSUFBSSxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUM7UUFDeEIsS0FBSyxNQUFNLElBQUksSUFBSSxJQUFJLENBQUMsUUFBUSxFQUFFO1lBQ2hDLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQztTQUNiO1FBQ0QsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLEVBQUUsQ0FBQztJQUMzQixDQUFDO0NBQ0Y7QUEzQ0Qsa0NBMkNDIn0=

View File

@ -0,0 +1,33 @@
export declare type TAvailableZone = 'Europe/Berlin';
export interface IDateUnits {
year: number;
yearString: string;
month: number;
monthString: string;
monthName: string;
day: number;
dayString: string;
dayOfTheWeek: number;
dayOfTheWeekName: string;
}
export declare class ExtendedDate extends Date {
static fromMillis(milliSeconds: number): ExtendedDate;
static fromDate(dateArg: Date): ExtendedDate;
static fromEuropeanDate(europeanDate: string): ExtendedDate;
/**
* creates an Extended date from a hypedDate like "2018-03-28"
* @param dateString
*/
static fromHyphedDate(dateString: string): ExtendedDate;
/**
* Same as .fromEuropeanDate(), but accepts additional timeArg and zoneArg
*/
static fromEuropeanDateAndTime(europeanDateArg: string, timeArg?: string, zoneArg?: TAvailableZone): ExtendedDate;
timezone: TAvailableZone;
constructor(unixMilli: number);
exportToEuropeanDate(): string;
/**
* exports units
*/
exportToUnits(): IDateUnits;
}

View File

@ -0,0 +1,117 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtendedDate = void 0;
const plugins = __importStar(require("./smarttime.plugins"));
class ExtendedDate extends Date {
constructor(unixMilli) {
super(unixMilli);
}
// STATIC factories
static fromMillis(milliSeconds) {
return new ExtendedDate(milliSeconds);
}
static fromDate(dateArg) {
return new ExtendedDate(dateArg.getTime());
}
static fromEuropeanDate(europeanDate) {
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDate);
const luxonDate = plugins.luxon.DateTime.utc(parseFloat(dateArray[3]), // year
parseFloat(dateArray[2]), // month
parseFloat(dateArray[1]) // day
);
const unixMilli = luxonDate.toMillis();
return new ExtendedDate(unixMilli);
}
/**
* creates an Extended date from a hypedDate like "2018-03-28"
* @param dateString
*/
static fromHyphedDate(dateString) {
// guards
// implementation
const dateMillis = new Date(dateString).getTime();
return new ExtendedDate(dateMillis);
}
/**
* Same as .fromEuropeanDate(), but accepts additional timeArg and zoneArg
*/
static fromEuropeanDateAndTime(europeanDateArg, timeArg = '12:00:00', zoneArg = 'Europe/Berlin') {
// guards
// implementation
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDateArg);
const sliceDate = (dateString) => {
return `0${dateString}`.slice(-2);
};
const dateTimeString = `${dateArray[3]}-${sliceDate(dateArray[2])}-${sliceDate(dateArray[1])}T${timeArg}`;
const luxonDate = plugins.luxon.DateTime.fromISO(dateTimeString, {
zone: zoneArg
});
const unixMilli = luxonDate.toMillis();
return new ExtendedDate(unixMilli);
}
//
exportToEuropeanDate() {
const units = this.exportToUnits();
return `${units.dayString}.${units.monthString}.${units.yearString}`;
}
/**
* exports units
*/
exportToUnits() {
const monthsArray = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
];
const daysArray = [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday'
];
return {
year: this.getFullYear(),
yearString: `${this.getFullYear()}`,
month: this.getMonth() + 1,
monthString: ("0" + (this.getMonth() + 1)).slice(-2),
monthName: monthsArray[this.getMonth()],
day: this.getDate(),
dayString: ("0" + this.getDate()).slice(-2),
dayOfTheWeek: this.getDay(),
dayOfTheWeekName: daysArray[this.getDay()]
};
}
}
exports.ExtendedDate = ExtendedDate;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuZXh0ZW5kZWRkYXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR0aW1lLmNsYXNzZXMuZXh0ZW5kZWRkYXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSw2REFBK0M7QUFnQi9DLE1BQWEsWUFBYSxTQUFRLElBQUk7SUE2RHBDLFlBQVksU0FBaUI7UUFDM0IsS0FBSyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQ25CLENBQUM7SUE5REQsbUJBQW1CO0lBQ1osTUFBTSxDQUFDLFVBQVUsQ0FBQyxZQUFvQjtRQUMzQyxPQUFPLElBQUksWUFBWSxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQ3hDLENBQUM7SUFFTSxNQUFNLENBQUMsUUFBUSxDQUFDLE9BQWE7UUFDbEMsT0FBTyxJQUFJLFlBQVksQ0FBQyxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQztJQUM3QyxDQUFDO0lBRU0sTUFBTSxDQUFDLGdCQUFnQixDQUFDLFlBQW9CO1FBQ2pELE1BQU0sU0FBUyxHQUFHLGtCQUFrQixDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBQztRQUN4RCxNQUFNLFNBQVMsR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFDL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FBSSxDQUFDLFdBQVcsRUFBRTtZQUN4QixVQUFVLEVBQUUsR0FBRyxJQUFJLENBQUMsV0FBVyxFQUFFLEVBQUU7WUFDbkMsS0FBSyxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsR0FBRyxDQUFDO1lBQzFCLFdBQVcsRUFBRSxDQUFDLEdBQUcsR0FBRyxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUNwRCxTQUFTLEVBQUUsV0FBVyxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQztZQUN2QyxHQUFHLEVBQUUsSUFBSSxDQUFDLE9BQU8sRUFBRTtZQUNuQixTQUFTLEVBQUUsQ0FBQyxHQUFHLEdBQUcsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQzNDLFlBQVksRUFBRSxJQUFJLENBQUMsTUFBTSxFQUFFO1lBQzNCLGdCQUFnQixFQUFFLFNBQVMsQ0FBQyxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7U0FDM0MsQ0FBQztJQUNKLENBQUM7Q0FDRjtBQTlHRCxvQ0E4R0MifQ==

View File

@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HrtMeasurement = void 0;
/**
* easy high resolution time measurement
*/
class HrtMeasurement {
constructor() {
this.nanoSeconds = null;
this.milliSeconds = null;
this._hrTimeStart = null;
this._hrTimeStopDiff = null;
this._started = false;
}
/**
* start the measurement
*/
start() {
this._started = true;
this._hrTimeStart = process.hrtime();
}
/**
* stop the measurement
*/
stop() {
if (this._started === false) {
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;
}
/**
* reset the measurement
*/
reset() {
this.nanoSeconds = null;
this.milliSeconds = null;
this._hrTimeStart = null;
this._hrTimeStopDiff = null;
this._started = false;
}
}
exports.HrtMeasurement = HrtMeasurement;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuaHJ0bWVhc3VyZW1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3Nlcy5ocnRtZWFzdXJlbWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQTs7R0FFRztBQUNILE1BQWEsY0FBYztJQUEzQjtRQUNTLGdCQUFXLEdBQVcsSUFBSSxDQUFDO1FBQzNCLGlCQUFZLEdBQVcsSUFBSSxDQUFDO1FBQzNCLGlCQUFZLEdBQUcsSUFBSSxDQUFDO1FBQ3BCLG9CQUFlLEdBQUcsSUFBSSxDQUFDO1FBQ3ZCLGFBQVEsR0FBWSxLQUFLLENBQUM7SUFrQ3BDLENBQUM7SUFoQ0M7O09BRUc7SUFDSSxLQUFLO1FBQ1YsSUFBSSxDQUFDLFFBQVEsR0FBRyxJQUFJLENBQUM7UUFDckIsSUFBSSxDQUFDLFlBQVksR0FBRyxPQUFPLENBQUMsTUFBTSxFQUFFLENBQUM7SUFDdkMsQ0FBQztJQUVEOztPQUVHO0lBQ0ksSUFBSTtRQUNULElBQUksSUFBSSxDQUFDLFFBQVEsS0FBSyxLQUFLLEVBQUU7WUFDM0IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO1lBQ2xDLE9BQU87U0FDUjtRQUNELElBQUksQ0FBQyxlQUFlLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUM7UUFDekQsSUFBSSxDQUFDLFdBQVcsR0FBRyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUMsQ0FBQyxHQUFHLEdBQUcsR0FBRyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzNFLElBQUksQ0FBQyxZQUFZLEdBQUcsSUFBSSxDQUFDLFdBQVcsR0FBRyxPQUFPLENBQUM7UUFDL0MsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBRUQ7O09BRUc7SUFDSSxLQUFLO1FBQ1YsSUFBSSxDQUFDLFdBQVcsR0FBRyxJQUFJLENBQUM7UUFDeEIsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7UUFDekIsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7UUFDekIsSUFBSSxDQUFDLGVBQWUsR0FBRyxJQUFJLENBQUM7UUFDNUIsSUFBSSxDQUFDLFFBQVEsR0FBRyxLQUFLLENBQUM7SUFDeEIsQ0FBQztDQUNGO0FBdkNELHdDQXVDQyJ9

11
dist_ts/smarttime.classes.interval.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
export declare class Interval {
status: 'started' | 'stopped' | 'initial';
private statusAuthorization;
intervalMilliseconds: number;
intervalJobs: Array<() => any>;
constructor(intervalMillisencondsArg: number);
start(): void;
stop(): void;
addIntervalJob(funcArg: () => any): void;
private executeIntervalJobs;
}

View File

@ -0,0 +1,57 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Interval = void 0;
const plugins = __importStar(require("./smarttime.plugins"));
class Interval {
constructor(intervalMillisencondsArg) {
this.status = 'initial';
this.statusAuthorization = null;
this.intervalJobs = [];
this.intervalMilliseconds = intervalMillisencondsArg;
}
start() {
this.status = 'started';
const statusAuth = new Date();
this.statusAuthorization = statusAuth;
const runInterval = async () => {
while (this.status === 'started' && this.statusAuthorization === statusAuth) {
await plugins.smartdelay.delayFor(this.intervalMilliseconds);
this.executeIntervalJobs();
}
};
runInterval();
}
stop() {
this.status = 'stopped';
this.statusAuthorization = null;
}
addIntervalJob(funcArg) {
this.intervalJobs.push(funcArg);
}
executeIntervalJobs() {
for (const funcArg of this.intervalJobs) {
funcArg();
}
}
}
exports.Interval = Interval;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuaW50ZXJ2YWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3Nlcy5pbnRlcnZhbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsNkRBQStDO0FBRS9DLE1BQWEsUUFBUTtJQU1uQixZQUFZLHdCQUFnQztRQUxyQyxXQUFNLEdBQXNDLFNBQVMsQ0FBQztRQUNyRCx3QkFBbUIsR0FBUSxJQUFJLENBQUM7UUFHakMsaUJBQVksR0FBcUIsRUFBRSxDQUFDO1FBRXpDLElBQUksQ0FBQyxvQkFBb0IsR0FBRyx3QkFBd0IsQ0FBQztJQUN2RCxDQUFDO0lBRU0sS0FBSztRQUNWLElBQUksQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDO1FBQ3hCLE1BQU0sVUFBVSxHQUFHLElBQUksSUFBSSxFQUFFLENBQUM7UUFDOUIsSUFBSSxDQUFDLG1CQUFtQixHQUFHLFVBQVUsQ0FBQztRQUN0QyxNQUFNLFdBQVcsR0FBRyxLQUFLLElBQUksRUFBRTtZQUM3QixPQUFPLElBQUksQ0FBQyxNQUFNLEtBQUssU0FBUyxJQUFJLElBQUksQ0FBQyxtQkFBbUIsS0FBSyxVQUFVLEVBQUU7Z0JBQzNFLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLG9CQUFvQixDQUFDLENBQUM7Z0JBQzdELElBQUksQ0FBQyxtQkFBbUIsRUFBRSxDQUFDO2FBQzVCO1FBQ0gsQ0FBQyxDQUFDO1FBQ0YsV0FBVyxFQUFFLENBQUM7SUFDaEIsQ0FBQztJQUVNLElBQUk7UUFDVCxJQUFJLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQztRQUN4QixJQUFJLENBQUMsbUJBQW1CLEdBQUcsSUFBSSxDQUFDO0lBQ2xDLENBQUM7SUFFTSxjQUFjLENBQUMsT0FBa0I7UUFDdEMsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDbEMsQ0FBQztJQUVPLG1CQUFtQjtRQUN6QixLQUFLLE1BQU0sT0FBTyxJQUFJLElBQUksQ0FBQyxZQUFZLEVBQUU7WUFDdkMsT0FBTyxFQUFFLENBQUM7U0FDWDtJQUNILENBQUM7Q0FDRjtBQXJDRCw0QkFxQ0MifQ==

38
dist_ts/smarttime.classes.timer.d.ts vendored Normal file
View File

@ -0,0 +1,38 @@
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<void>;
/**
* a reference to when the Timeout started
*/
startedAt: TimeStamp;
/**
* a reference to when a Timer has been potentially paused
*/
pausedAt: TimeStamp;
get 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;
reset(): void;
}

View File

@ -0,0 +1,77 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Timer = void 0;
const plugins = __importStar(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.smartpromise.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() {
if (this.startedAt) {
clearTimeout(this.currentTimeout);
this.currentTimeout = null;
this.pausedAt = smarttime_classes_timestamp_1.TimeStamp.fromTimeStamp(this.startedAt);
}
}
resume() {
if (this.startedAt) {
this.currentTimeout = setTimeout(() => {
this.completedDeferred.resolve();
}, this.timeLeft);
}
else {
throw new Error('timer has NOT been started before. Please use .start() instead');
}
}
reset() {
this.pause();
this.startedAt = null;
this.pausedAt = null;
}
}
exports.Timer = Timer;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMudGltZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3Nlcy50aW1lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsNkRBQStDO0FBRS9DLCtFQUEwRDtBQUkxRCxNQUFhLEtBQUs7SUFxQ2hCLFlBQVkscUJBQTZCO1FBL0J6Qzs7V0FFRztRQUNJLFVBQUssR0FBZSxXQUFXLENBQUM7UUF5QnZDLGdEQUFnRDtRQUN4QyxzQkFBaUIsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBUSxDQUFDO1FBRzdELElBQUksQ0FBQyxrQkFBa0IsR0FBRyxxQkFBcUIsQ0FBQztRQUNoRCxJQUFJLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxPQUFPLENBQUM7SUFDbEQsQ0FBQztJQWRELElBQUksUUFBUTtRQUNWLE9BQU8sSUFBSSxDQUFDLGtCQUFrQixHQUFHLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDO0lBQ3hELENBQUM7SUFjRDs7T0FFRztJQUNJLEtBQUs7UUFDVixJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRTtZQUNuQixJQUFJLENBQUMsY0FBYyxHQUFHLFVBQVUsQ0FBQyxHQUFHLEVBQUU7Z0JBQ3BDLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxPQUFPLEVBQUUsQ0FBQztZQUNuQy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/
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,19 +30,16 @@ 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
*/
isOlderThan(TimeStampArg: TimeStamp): boolean;
isYoungerThan(TimeStampArg: TimeStamp): boolean;
isOlderThan(TimeStampArg: TimeStamp, tresholdTimeArg?: number): boolean;
/**
* returns a boolean for wether a timestamp is younger
* @param TimeStampArg
* @param tresholdTimeArg
*/
isYoungerThanOtherTimeStamp(TimeStampArg: TimeStamp, tresholdTimeArg?: number): boolean;
isYoungerThanMilliSeconds(millisecondArg: number): boolean;
}

View File

@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeStamp = void 0;
/**
* TimeStamp
* smart timestamp
*/
class TimeStamp {
constructor(creatorArg) {
/**
* if derived from another TimeStamp points out the change in milliseconds
*/
this.change = null;
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);
}
/**
* returns new TimeStamp for now with change set
* @param timeStampArg
*/
static fromTimeStamp(timeStampArg) {
const localTimeStamp = new TimeStamp();
localTimeStamp.change = localTimeStamp.milliSeconds - timeStampArg.milliSeconds;
return localTimeStamp;
}
/**
* Is the current instance older than the argument
* @param TimeStampArg
*/
isOlderThan(TimeStampArg, tresholdTimeArg = 0) {
if (this.milliSeconds + tresholdTimeArg < TimeStampArg.milliSeconds) {
return true;
}
else {
return false;
}
}
/**
* returns a boolean for wether a timestamp is younger
* @param TimeStampArg
* @param tresholdTimeArg
*/
isYoungerThanOtherTimeStamp(TimeStampArg, tresholdTimeArg = 0) {
if (this.milliSeconds > TimeStampArg.milliSeconds + tresholdTimeArg) {
return true;
}
else {
return false;
}
}
isYoungerThanMilliSeconds(millisecondArg) {
const nowTimeStamp = new TimeStamp();
const compareEpochTime = nowTimeStamp.epochtime - millisecondArg;
const compareTimeStamp = new TimeStamp(compareEpochTime);
return this.isYoungerThanOtherTimeStamp(compareTimeStamp);
}
}
exports.TimeStamp = TimeStamp;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMudGltZXN0YW1wLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR0aW1lLmNsYXNzZXMudGltZXN0YW1wLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUVBOzs7R0FHRztBQUNILE1BQWEsU0FBUztJQXVDcEIsWUFBWSxVQUFtQjtRQUwvQjs7V0FFRztRQUNJLFdBQU0sR0FBVyxJQUFJLENBQUM7UUFHM0IsSUFBSSxDQUFDLFVBQVUsRUFBRTtZQUNmLElBQUksQ0FBQyxJQUFJLEdBQUcsSUFBSSxJQUFJLEVBQUUsQ0FBQztTQUN4QjthQUFNLElBQUksT0FBTyxVQUFVLEtBQUssUUFBUSxFQUFFO1lBQ3pDLElBQUksQ0FBQyxJQUFJLEdBQUcsSUFBSSxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUM7U0FDbEM7UUFDRCxJQUFJLENBQUMsWUFBWSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDeEMsSUFBSSxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDL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GNBQWMsQ0FBQztRQUNqRSxNQUFNLGdCQUFnQixHQUFHLElBQUksU0FBUyxDQUFDLGdCQUFnQixDQUFDLENBQUM7UUFDekQsT0FBTyxJQUFJLENBQUMsMkJBQTJCLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztJQUM1RCxDQUFDO0NBQ0Y7QUFoRkQsOEJBZ0ZDIn0=

6
dist_ts/smarttime.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartpromise from '@pushrocks/smartpromise';
export { smartdelay, smartpromise };
import cronParser from 'cron-parser';
import * as luxon from 'luxon';
export { cronParser, luxon };

View File

@ -0,0 +1,36 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.luxon = exports.cronParser = exports.smartpromise = exports.smartdelay = void 0;
// @pushrocks scope
const smartdelay = __importStar(require("@pushrocks/smartdelay"));
exports.smartdelay = smartdelay;
const smartpromise = __importStar(require("@pushrocks/smartpromise"));
exports.smartpromise = smartpromise;
// third parties
const cron_parser_1 = __importDefault(require("cron-parser"));
exports.cronParser = cron_parser_1.default;
const luxon = __importStar(require("luxon"));
exports.luxon = luxon;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsbUJBQW1CO0FBQ25CLGtFQUFvRDtBQUczQyxnQ0FBVTtBQUZuQixzRUFBd0Q7QUFFbkMsb0NBQVk7QUFFakMsZ0JBQWdCO0FBQ2hCLDhEQUFxQztBQUc1QixxQkFIRixxQkFBVSxDQUdFO0FBRm5CLDZDQUErQjtBQUVWLHNCQUFLIn0=

17
dist_ts/smarttime.units.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
export declare let units: {
years: (timesArg?: number) => number;
months: (timesArg?: number) => number;
weeks: (timesArg?: number) => number;
days: (timesArg?: number) => number;
hours: (timesArg?: number) => number;
minutes: (timesArg?: number) => number;
};
export interface IUnitCombinationArg {
years?: number;
months?: number;
weeks?: number;
days?: number;
hours?: number;
minutes?: number;
}
export declare let getMilliSecondsFromUnits: (combinationArg: IUnitCombinationArg) => number;

View File

@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMilliSecondsFromUnits = exports.units = void 0;
exports.units = {
years: (timesArg = 1) => {
return timesArg * 3.154e10;
},
months: (timesArg = 1) => {
return timesArg * 2.628e9;
},
weeks: (timesArg = 1) => {
return timesArg * 6.048e8;
},
days: (timesArg = 1) => {
return timesArg * 8.64e7;
},
hours: (timesArg = 1) => {
return timesArg * 3.6e6;
},
minutes: (timesArg = 1) => {
return timesArg * 60000;
}
};
exports.getMilliSecondsFromUnits = (combinationArg) => {
let timeInMilliseconds = 0;
let addMilliSeconds = milliSecondsArg => {
timeInMilliseconds = timeInMilliseconds + milliSecondsArg;
};
if (combinationArg.years) {
addMilliSeconds(exports.units.years(combinationArg.years));
}
if (combinationArg.months) {
addMilliSeconds(exports.units.months(combinationArg.months));
}
if (combinationArg.weeks) {
addMilliSeconds(exports.units.weeks(combinationArg.weeks));
}
if (combinationArg.days) {
addMilliSeconds(exports.units.days(combinationArg.days));
}
if (combinationArg.hours) {
addMilliSeconds(exports.units.hours(combinationArg.hours));
}
if (combinationArg.minutes) {
addMilliSeconds(exports.units.minutes(combinationArg.minutes));
}
return timeInMilliseconds;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnVuaXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR0aW1lLnVuaXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFXLFFBQUEsS0FBSyxHQUFHO0lBQ2pCLEtBQUssRUFBRSxDQUFDLFFBQVEsR0FBRyxDQUFDLEVBQVUsRUFBRTtRQUM5QixPQUFPLFFBQVEsR0FBRyxRQUFRLENBQUM7SUFDN0IsQ0FBQztJQUNELE1BQU0sRUFBRSxDQUFDLFFBQVEsR0FBRyxDQUFDLEVBQVUsRUFBRTtRQUMvQixPQUFPLFFBQVEsR0FBRyxPQUFPLENBQUM7SUFDNUIsQ0FBQztJQUNELEtBQUssRUFBRSxDQUFDLFFBQVEsR0FBRyxDQUFDLEVBQUUsRUFBRTtRQUN0QixPQUFPLFFBQVEsR0FBRyxPQUFPLENBQUM7SUFDNUIsQ0FBQztJQUNELElBQUksRUFBRSxDQUFDLFFBQVEsR0FBRyxDQUFDLEVBQUUsRUFBRTtRQUNyQixPQUFPLFFBQVEsR0FBRyxNQUFNLENBQUM7SUFDM0IsQ0FBQztJQUNELEtBQUssRUFBRSxDQUFDLFFBQVEsR0FBRyxDQUFDLEVBQUUsRUFBRTtRQUN0QixPQUFPLFFBQVEsR0FBRyxLQUFLLENBQUM7SUFDMUIsQ0FBQztJQUNELE9BQU8sRUFBRSxDQUFDLFFB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FPLEVBQUU7UUFDMUIsZUFBZSxDQUFDLGFBQUssQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7S0FDeEQ7SUFFRCxPQUFPLGtCQUFrQixDQUFDO0FBQzVCLENBQUMsQ0FBQyJ9

View File

@ -1,29 +0,0 @@
# 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)
[![Dependency Status](https://david-dm.org/pushrocks/smarttime.svg)](https://david-dm.org/pushrocks/smarttime)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smarttime/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smarttime/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smarttime/badges/code.svg)](https://www.bithound.io/github/pushrocks/smarttime)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![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 | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| 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)

View File

@ -1,7 +1,16 @@
{
"npmci": {
"globalNpmTools": [
"npmts"
]
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smarttime",
"shortDescription": "handle time in smart ways",
"npmPackagename": "@pushrocks/smarttime",
"license": "MIT"
}
}
}

3288
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,42 @@
{
"name": "smarttime",
"version": "1.0.4",
"description": "handle timeformats in smart ways",
"name": "@pushrocks/smarttime",
"private": false,
"version": "3.0.13",
"description": "handle time in smart ways",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(npmts)"
"test": "(tstest ./test/)",
"build": "(tsbuild && tsbundle npm)"
},
"devDependencies": {
"tapbundle": "^1.0.13"
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsbundle": "^1.0.69",
"@gitzone/tsrun": "^1.2.6",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.9",
"@types/node": "^14.0.5",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"typings-global": "^1.0.16"
}
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.2",
"@types/cron": "^1.7.1",
"@types/luxon": "^1.15.1",
"cron-parser": "^2.14.0",
"luxon": "^1.16.0"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"assets/*",
"cli.js",
"npmextra.json",
"readme.md"
]
}

View File

@ -1,29 +1,50 @@
# smarttime
handle timeformats in smart ways
# @pushrocks/smarttime
handle time 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/)
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smarttime)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smarttime)
* [github.com (source mirror)](https://github.com/pushrocks/smarttime)
* [docs (typedoc)](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)
[![Dependency Status](https://david-dm.org/pushrocks/smarttime.svg)](https://david-dm.org/pushrocks/smarttime)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smarttime/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smarttime/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smarttime/badges/code.svg)](https://www.bithound.io/github/pushrocks/smarttime)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![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/@pushrocks/smarttime.svg)](https://www.npmjs.com/package/@pushrocks/smarttime)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smarttime/badge.svg)](https://snyk.io/test/npm/@pushrocks/smarttime)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
Smarttime offers smart ways to deal with time.
### class CronManager
This class provides scheduling of functions with a cron syntax
```typescript
import { CronManager } from '@pushrocks/smarrtime';
const cronManagerInstance = new CronManager();
cronManagerInstance.addConrjob('* * * * * *', async () => {
console.log('hello'); // will log 'hello' to console once every second;
})
cronManagerInstance.start();
```
### class ExtendedDate
This class offers static functions to create zone specific JavaScript dates from European formated time strings.
```TypeScript
import { ExtendedDate } from '@pushrocks/smarttime'
const myDate: Date = ExtendedDate.fromEuropeanDate('8.6.2018')
```
For further information read the linked docs at the top of this readme.
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| 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)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

27
test/test.cronmanager.ts Normal file
View File

@ -0,0 +1,27 @@
import { tap, expect } from '@pushrocks/tapbundle';
import * as smarttime from '../ts/index';
let testCronManager: smarttime.CronManager;
tap.test('should create a valid instance of cronmanager', async () => {
testCronManager = new smarttime.CronManager();
expect(testCronManager).to.be.instanceOf(smarttime.CronManager);
});
tap.test('should create a valid cronJon', async tools => {
const done = tools.defer();
let counter = 0;
testCronManager.addCronjob('* * * * * *', () => {
if (counter === 10) {
done.resolve();
}
counter++;
console.log(`hey ${counter}`);
});
testCronManager.start();
await done.promise;
testCronManager.stop();
});
tap.start();

24
test/test.extendeddate.ts Normal file
View File

@ -0,0 +1,24 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smarttime from '../ts/index';
tap.test('should create a valid JavaScript Date from European TimeStamp', async () => {
const extendedDate = smarttime.ExtendedDate.fromEuropeanDate('1.6.2018');
console.log(extendedDate);
});
tap.test('should create a date and time with European Format', async () => {
const extendedDate = smarttime.ExtendedDate.fromEuropeanDateAndTime(
'9.8.2018',
'08:00:00',
'Europe/Berlin'
);
console.log(extendedDate);
});
tap.test('should create a European date string', async () => {
const extendedDate = smarttime.ExtendedDate.fromHyphedDate('2018-02-13');
expect(extendedDate.exportToEuropeanDate()).to.equal('13.02.2018');
});
tap.start();

26
test/test.timer.ts Normal file
View File

@ -0,0 +1,26 @@
// tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from '@pushrocks/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.test('should reset a timer', async () => {
testTimer.reset();
testTimer.start();
testTimer.reset();
testTimer.start();
await testTimer.completed;
});
tap.start();

View File

@ -1,36 +1,50 @@
import { expect, tap } from 'tapbundle'
import * as smarttime from '../ts/index'
// tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from '@pushrocks/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.isYoungerThanOtherTimeStamp(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 () => {
const computedTime = smarttime.getMilliSecondsFromUnits({
years: 2,
// tslint:disable-next-line:object-literal-sort-keys
months: 2,
weeks: 2,
days: 2,
hours: 2,
minutes: 2
});
// tslint:disable-next-line:no-console
console.log(computedTime);
});
tap.start()
tap.start();

View File

@ -1,4 +1,10 @@
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.classes.cronmanager';
export * from './smarttime.classes.extendeddate';
export * from './smarttime.classes.hrtmeasurement';
export * from './smarttime.classes.timer';
export * from './smarttime.classes.timestamp';
export * from './smarttime.units';
export { luxon } from './smarttime.plugins';

View File

@ -0,0 +1,45 @@
import * as plugins from './smarttime.plugins';
import { CronManager } from './smarttime.classes.cronmanager';
export type TJobFunction = (() => void) | (() => Promise<any>);
export class CronJob {
public status: 'started' | 'stopped' | 'initial' = 'initial';
public cronExpression: string;
public jobFunction: TJobFunction;
private cronInterval= plugins.cronParser.parseExpression('* * * * * *');
private nextExecutionUnix: number = 0;
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction ) {
this.cronExpression = cronExpressionArg;
this.jobFunction = jobFunction;
}
/**
* checks wether the cronjob needs to be executed
*/
public checkExecution() {
if (this.nextExecutionUnix === 0) {
this.nextExecutionUnix = this.cronInterval.next().toDate().getTime();
return;
}
if (Date.now() > this.nextExecutionUnix) {
this.jobFunction();
this.nextExecutionUnix = this.cronInterval.next().toDate().getTime();
}
}
public start() {
this.cronInterval = this.getCronInterval();
this.status = 'started';
}
public stop() {
this.status = 'stopped';
}
private getCronInterval () {
return plugins.cronParser.parseExpression(this.cronExpression);
}
}

View File

@ -0,0 +1,49 @@
import * as plugins from './smarttime.plugins';
import { CronJob } from './smarttime.classes.cronjob';
import { Timer } from './smarttime.classes.timer';
import { Interval } from './smarttime.classes.interval';
export class CronManager {
public cronInterval = new Interval(1000);
public status: 'started' | 'stopped' = 'stopped';
public cronjobs: CronJob[] = [];
constructor() {
this.cronInterval.addIntervalJob(() => {
for (const cronJob of this.cronjobs) {
cronJob.checkExecution();
}
});
}
public addCronjob(cronIdentifierArg: string, cronFunctionArg: () => any) {
const newCronJob = new CronJob(this, cronIdentifierArg, cronFunctionArg);
this.cronjobs.push(newCronJob);
if (this.status === 'started') {
newCronJob.start();
}
}
/**
* starts the cronjob
*/
public start() {
this.status = 'started';
for (const cron of this.cronjobs) {
cron.start();
}
this.cronInterval.start();
}
/**
* stops all cronjobs
*/
public stop() {
this.status = 'stopped';
for (const cron of this.cronjobs) {
cron.stop();
}
this.cronInterval.stop();
}
}

View File

@ -0,0 +1,127 @@
import * as plugins from './smarttime.plugins';
export type TAvailableZone = 'Europe/Berlin';
export interface IDateUnits {
year: number;
yearString: string;
month: number;
monthString: string;
monthName: string;
day: number;
dayString: string;
dayOfTheWeek: number;
dayOfTheWeekName: string;
}
export class ExtendedDate extends Date {
// STATIC factories
public static fromMillis(milliSeconds: number) {
return new ExtendedDate(milliSeconds);
}
public static fromDate(dateArg: Date) {
return new ExtendedDate(dateArg.getTime());
}
public static fromEuropeanDate(europeanDate: string) {
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDate);
const luxonDate = plugins.luxon.DateTime.utc(
parseFloat(dateArray[3]), // year
parseFloat(dateArray[2]), // month
parseFloat(dateArray[1]) // day
);
const unixMilli = luxonDate.toMillis();
return new ExtendedDate(unixMilli);
}
/**
* creates an Extended date from a hypedDate like "2018-03-28"
* @param dateString
*/
public static fromHyphedDate(dateString: string) {
// guards
// implementation
const dateMillis = new Date(dateString).getTime();
return new ExtendedDate(dateMillis);
}
/**
* Same as .fromEuropeanDate(), but accepts additional timeArg and zoneArg
*/
public static fromEuropeanDateAndTime(
europeanDateArg: string,
timeArg: string = '12:00:00',
zoneArg: TAvailableZone = 'Europe/Berlin'
) {
// guards
// implementation
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDateArg);
const sliceDate = (dateString: string) => {
return `0${dateString}`.slice(-2);
};
const dateTimeString = `${dateArray[3]}-${sliceDate(dateArray[2])}-${sliceDate(
dateArray[1]
)}T${timeArg}`;
const luxonDate = plugins.luxon.DateTime.fromISO(dateTimeString, {
zone: zoneArg
});
const unixMilli = luxonDate.toMillis();
return new ExtendedDate(unixMilli);
}
// INSTANCE
public timezone: TAvailableZone;
constructor(unixMilli: number) {
super(unixMilli);
}
//
public exportToEuropeanDate() {
const units = this.exportToUnits();
return `${units.dayString}.${units.monthString}.${units.yearString}`;
}
/**
* exports units
*/
public exportToUnits(): IDateUnits {
const monthsArray = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
];
const daysArray = [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday'
];
return {
year: this.getFullYear(),
yearString: `${this.getFullYear()}`,
month: this.getMonth() + 1,
monthString: ("0" + (this.getMonth() + 1)).slice(-2),
monthName: monthsArray[this.getMonth()],
day: this.getDate(),
dayString: ("0" + this.getDate()).slice(-2),
dayOfTheWeek: this.getDay(),
dayOfTheWeekName: daysArray[this.getDay()]
};
}
}

View File

@ -1,45 +1,43 @@
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
public nanoSeconds: number = null;
public milliSeconds: number = null;
private _hrTimeStart = null;
private _hrTimeStopDiff = null;
private _started: boolean = false;
/**
* start the measurement
*/
start () {
this._started = true
this._hrTimeStart = process.hrtime()
public start() {
this._started = true;
this._hrTimeStart = process.hrtime();
}
/**
* stop the measurement
*/
stop () {
public 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
public reset() {
this.nanoSeconds = null;
this.milliSeconds = null;
this._hrTimeStart = null;
this._hrTimeStopDiff = null;
this._started = false;
}
}

View File

@ -0,0 +1,40 @@
import * as plugins from './smarttime.plugins';
export class Interval {
public status: 'started' | 'stopped' | 'initial' = 'initial';
private statusAuthorization: any = null;
public intervalMilliseconds: number;
public intervalJobs: Array<() => any> = [];
constructor(intervalMillisencondsArg: number) {
this.intervalMilliseconds = intervalMillisencondsArg;
}
public start() {
this.status = 'started';
const statusAuth = new Date();
this.statusAuthorization = statusAuth;
const runInterval = async () => {
while (this.status === 'started' && this.statusAuthorization === statusAuth) {
await plugins.smartdelay.delayFor(this.intervalMilliseconds);
this.executeIntervalJobs();
}
};
runInterval();
}
public stop () {
this.status = 'stopped';
this.statusAuthorization = null;
}
public addIntervalJob(funcArg: () => any) {
this.intervalJobs.push(funcArg);
}
private executeIntervalJobs () {
for (const funcArg of this.intervalJobs) {
funcArg();
}
}
}

View File

@ -0,0 +1,86 @@
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<void>;
/**
* 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.smartpromise.defer<void>();
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() {
if (this.startedAt) {
clearTimeout(this.currentTimeout);
this.currentTimeout = null;
this.pausedAt = TimeStamp.fromTimeStamp(this.startedAt);
}
}
public resume() {
if (this.startedAt) {
this.currentTimeout = setTimeout(() => {
this.completedDeferred.resolve();
}, this.timeLeft);
} else {
throw new Error('timer has NOT been started before. Please use .start() instead');
}
}
public reset() {
this.pause();
this.startedAt = null;
this.pausedAt = null;
}
}

View File

@ -1,75 +1,87 @@
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) {
if (this.milliSeconds < 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) {
if (this.milliSeconds > TimeStampArg.milliSeconds) {
return true
/**
* returns a boolean for wether a timestamp is younger
* @param TimeStampArg
* @param tresholdTimeArg
*/
public isYoungerThanOtherTimeStamp(TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) {
if (this.milliSeconds > TimeStampArg.milliSeconds + tresholdTimeArg) {
return true;
} else {
return false
return false;
}
}
public isYoungerThanMilliSeconds(millisecondArg: number) {
const nowTimeStamp = new TimeStamp();
const compareEpochTime = nowTimeStamp.epochtime - millisecondArg;
const compareTimeStamp = new TimeStamp(compareEpochTime);
return this.isYoungerThanOtherTimeStamp(compareTimeStamp);
}
}

View File

@ -1 +1,11 @@
import 'typings-global'
// @pushrocks scope
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartpromise from '@pushrocks/smartpromise';
export { smartdelay, smartpromise };
// third parties
import cronParser from 'cron-parser';
import * as luxon from 'luxon';
export { cronParser, luxon };

56
ts/smarttime.units.ts Normal file
View File

@ -0,0 +1,56 @@
export let units = {
years: (timesArg = 1): number => {
return timesArg * 3.154e10;
},
months: (timesArg = 1): number => {
return timesArg * 2.628e9;
},
weeks: (timesArg = 1) => {
return timesArg * 6.048e8;
},
days: (timesArg = 1) => {
return timesArg * 8.64e7;
},
hours: (timesArg = 1) => {
return timesArg * 3.6e6;
},
minutes: (timesArg = 1) => {
return timesArg * 60000;
}
};
export interface IUnitCombinationArg {
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;
};
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;
};

View File

@ -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"
}

386
yarn.lock
View File

@ -1,386 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# 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"
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"
dependencies:
"@types/minimatch" "*"
"@types/node" "*"
"@types/minimatch@*":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.0.tgz#a8b68c324817169b6004b432a598478a5d8f025a"
"@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"
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"
beautycolor@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
dependencies:
ansi-256-colors "^1.1.0"
typings-global "^1.0.14"
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"
dependencies:
check-error "^1.0.2"
chai-string@^1.3.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"
dependencies:
assertion-error "^1.0.1"
deep-eql "^0.1.3"
type-detect "^1.0.0"
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"
dependencies:
type-detect "0.1.1"
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
foreach "^2.0.5"
object-keys "^1.0.8"
early@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
dependencies:
beautycolor "^1.0.7"
smartq "^1.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"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.0"
has "^1.0.1"
is-callable "^1.1.3"
is-regex "^1.0.4"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.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"
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.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"
has@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
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"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
dependencies:
has "^1.0.1"
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"
dependencies:
es6-error "^4.0.2"
left-pad "^1.1.3"
memwatch-next "^0.3.0"
minimist "^1.2.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"
memwatch-next@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
dependencies:
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"
nan@^2.3.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object.getownpropertydescriptors@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
dependencies:
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"
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"
dependencies:
resolve "^1.1.6"
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"
dependencies:
smartq "^1.1.1"
typings-global "^1.0.16"
smartq@^1.1.1, smartq@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
dependencies:
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"
dependencies:
early "^2.1.1"
leakage "^0.3.0"
smartchai "^1.0.3"
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"
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"
util.promisify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
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"