Compare commits

..

150 Commits

Author SHA1 Message Date
51943fad1c 4.2.0 2024-12-14 02:22:43 +01:00
ce3af11ca8 feat(ondemand): Add on-demand timestamp feature 2024-12-14 02:22:43 +01:00
a941f10af3 4.1.1 2024-12-13 22:09:31 +01:00
6e7f8f3dda fix(smarttime.units): Fix issue in getMilliSecondsAsHumanReadableAgoTime 2024-12-13 22:09:30 +01:00
bfa00feadd 4.1.0 2024-12-13 22:04:26 +01:00
55c2d95b7d feat(smarttime.units): Add function to get human-readable time ago string from milliseconds. 2024-12-13 22:04:26 +01:00
71ce4de8ff 4.0.9 2024-12-13 21:55:02 +01:00
491176bb35 fix(dependencies): Updated dependencies in package.json and resolved cron function issues. 2024-12-13 21:55:02 +01:00
35e387da7c 4.0.8 2024-06-23 23:30:15 +02:00
c96248ea72 fix(documentation): Corrected formatting issues in changelog.md 2024-06-23 23:30:14 +02:00
7eb8e9c4f7 4.0.7 2024-06-23 23:27:11 +02:00
c0e9a7f19a fix(build): Remove GitLab CI configuration and update dependencies in package.json 2024-06-23 23:27:10 +02:00
6e18d6e13c update description 2024-05-29 14:16:49 +02:00
580b33448e update tsconfig 2024-04-14 18:28:37 +02:00
691c4f0aba update tsconfig 2024-04-01 21:41:37 +02:00
f06abc49b6 update npmextra.json: githost 2024-04-01 19:59:55 +02:00
1adfed02df update npmextra.json: githost 2024-03-30 21:48:56 +01:00
22e6798a3c 4.0.6 2023-10-20 12:50:48 +02:00
4dd4980374 fix(core): update 2023-10-20 12:50:47 +02:00
edadbe6cf5 4.0.5 2023-08-13 21:55:07 +02:00
58f213a099 fix(core): update 2023-08-13 21:55:06 +02:00
1e5fd80a69 4.0.4 2023-07-21 03:39:59 +02:00
1de9412a31 fix(core): update 2023-07-21 03:39:59 +02:00
fa3ac0ff77 4.0.3 2023-07-21 03:39:33 +02:00
25eee6cf73 fix(core): update 2023-07-21 03:39:32 +02:00
c290a75f01 4.0.2 2023-07-12 11:28:52 +02:00
9a20f8f6a1 fix(core): update 2023-07-12 11:28:52 +02:00
f91fa33568 4.0.1 2023-01-06 20:05:03 +01:00
c234cb4caa fix(core): update 2023-01-06 20:05:02 +01:00
5f5957b0c0 4.0.0 2022-11-21 12:33:26 +01:00
31275536ec BREAKING CHANGE(core): switch to esm 2022-11-21 12:33:25 +01:00
c759d436dd 3.0.48 2022-11-21 11:31:30 +01:00
010c9e7bed fix(core): update 2022-11-21 11:31:29 +01:00
264c08d848 3.0.47 2022-11-21 09:14:32 +01:00
b2a5cda468 fix(core): update 2022-11-21 09:14:32 +01:00
d3dd03534a 3.0.46 2022-11-21 01:19:39 +01:00
9b96779d19 fix(core): update 2022-11-21 01:19:38 +01:00
20b181b2f3 3.0.45 2022-02-02 17:03:59 +01:00
d278722da2 fix(core): update 2022-02-02 17:03:58 +01:00
e3daf08d67 3.0.44 2022-02-02 16:55:13 +01:00
0483b55a9e fix(core): update 2022-02-02 16:55:12 +01:00
c3a772c155 3.0.43 2021-11-08 16:56:11 +01:00
a2ffdd436f fix(timestamp): add missing .isOlderThanOtherTimeStamp() to TimeStamp class 2021-11-08 16:56:11 +01:00
da9c71eedb 3.0.42 2021-11-08 16:52:14 +01:00
63405fc577 fix(readme): fix readme 2021-11-08 16:52:13 +01:00
d789eec558 3.0.41 2021-11-08 16:49:33 +01:00
22027d2308 fix(update croner): update croner package, closes #1. Thank you @Hexagon4 2021-11-08 16:49:33 +01:00
87d29fbb50 3.0.40 2021-11-08 16:40:19 +01:00
1c5a1c21da fix(core): update 2021-11-08 16:40:19 +01:00
969088ad04 3.0.39 2021-10-06 11:58:36 +02:00
76768a1307 fix(core): update 2021-10-06 11:58:36 +02:00
419fe80bde 3.0.38 2021-01-02 19:30:16 +00:00
5a9584917c fix(core): update 2021-01-02 19:30:15 +00:00
2b21ee9a24 3.0.37 2020-10-05 22:28:40 +00:00
3a110c9fd9 fix(core): update 2020-10-05 22:28:40 +00:00
25f7ad37ae 3.0.36 2020-10-05 17:48:42 +00:00
992d167a34 fix(core): update 2020-10-05 17:48:41 +00:00
cfcfde2132 3.0.35 2020-09-07 23:44:08 +00:00
b5ab945501 fix(core): update 2020-09-07 23:44:07 +00:00
88378e2f31 3.0.34 2020-09-07 17:16:12 +00:00
db92311daa fix(core): update 2020-09-07 17:16:11 +00:00
36bff0a70a 3.0.33 2020-09-07 16:44:55 +00:00
fa8fd9fa35 fix(core): update 2020-09-07 16:44:54 +00:00
dd783b455f 3.0.32 2020-09-07 12:13:28 +00:00
996685e7fb fix(core): update 2020-09-07 12:13:27 +00:00
110b2c00cf 3.0.31 2020-09-04 15:18:41 +00:00
c8b455b8e2 fix(core): update 2020-09-04 15:18:41 +00:00
d16fd8b69b 3.0.30 2020-09-04 14:24:42 +00:00
f7ed88cd57 fix(core): update 2020-09-04 14:24:42 +00:00
19b5ba4a5d 3.0.29 2020-09-04 06:39:22 +00:00
457182a97a fix(core): update 2020-09-04 06:39:22 +00:00
a7a961c869 3.0.28 2020-09-03 20:14:23 +00:00
f1d7771e30 fix(core): update 2020-09-03 20:14:23 +00:00
ff16b70206 3.0.27 2020-09-03 20:06:03 +00:00
8e43ce7e9b fix(core): update 2020-09-03 20:06:02 +00:00
f129ce42b6 3.0.26 2020-09-02 14:27:11 +00:00
56a802664f fix(core): update 2020-09-02 14:27:11 +00:00
743c9fb847 3.0.25 2020-09-02 14:09:22 +00:00
ac2edd6d74 fix(core): update 2020-09-02 14:09:21 +00:00
725102d02c 3.0.24 2020-07-12 00:25:56 +00:00
7c73579c9f fix(core): update 2020-07-12 00:25:55 +00:00
a1996ea1bd 3.0.23 2020-07-12 00:00:50 +00:00
dc92ae7140 fix(core): update 2020-07-12 00:00:50 +00:00
3e862f233c 3.0.22 2020-07-11 23:36:24 +00:00
73f7360f8c fix(core): update 2020-07-11 23:36:24 +00:00
2c74de8aef 3.0.21 2020-07-11 23:31:10 +00:00
78498626ea fix(core): update 2020-07-11 23:31:09 +00:00
b2299b149a 3.0.20 2020-07-11 21:41:33 +00:00
885b2432a8 fix(core): update 2020-07-11 21:41:33 +00:00
7a231b7686 3.0.19 2020-07-07 22:37:42 +00:00
ef6e21080e fix(core): update 2020-07-07 22:37:41 +00:00
3ea8b1564d 3.0.18 2020-05-27 18:16:12 +00:00
1b92240c4e fix(core): update 2020-05-27 18:16:11 +00:00
95bf558503 3.0.17 2020-05-27 16:59:27 +00:00
d1ff77d9f5 fix(core): update 2020-05-27 16:59:26 +00:00
b77677b089 3.0.16 2020-05-25 22:21:55 +00:00
5ebd9ce6de fix(core): update 2020-05-25 22:21:55 +00:00
702365aba3 3.0.15 2020-05-25 21:49:36 +00:00
93778e1bcf fix(core): update 2020-05-25 21:49:35 +00:00
4d0fb3eb30 3.0.14 2020-05-25 21:49:08 +00:00
3f0b230d23 fix(core): update 2020-05-25 21:49:08 +00:00
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
46 changed files with 11717 additions and 944 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

17
.gitignore vendored
View File

@ -1,5 +1,20 @@
.nogit/
node_modules/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,71 +0,0 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- test
- release
- trigger
- pages
testLEGACY:
stage: test
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage
tags:
- docker
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public

11
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

120
changelog.md Normal file
View File

@ -0,0 +1,120 @@
# Changelog
## 2024-12-14 - 4.2.0 - feat(ondemand)
Add on-demand timestamp feature
- Added an on-demand script to output human-readable time ago for current timestamp.
## 2024-12-13 - 4.1.1 - fix(smarttime.units)
Fix issue in getMilliSecondsAsHumanReadableAgoTime
- Corrected the parameter type passed to date-fns.formatDistanceToNow within getMilliSecondsAsHumanReadableAgoTime function.
## 2024-12-13 - 4.1.0 - feat(smarttime.units)
Add function to get human-readable time ago string from milliseconds.
- Introduced `getMilliSecondsAsHumanReadableAgoTime` to convert a timestamp to a human-readable text indicating time ago.
## 2024-12-13 - 4.0.9 - fix(dependencies)
Updated dependencies in package.json and resolved cron function issues.
- Updated multiple dependencies in package.json to their latest versions.
- Fixed issue in cron job instantiation by correcting the import and initialization of the croner.Cron class.
## 2024-06-23 - 4.0.8 - fix(documentation)
Corrected formatting issues in changelog.md
- Fixed markdown formatting by removing unnecessary newlines.
## 2024-06-23 - 4.0.7 - fix(build)
Remove GitLab CI configuration and update dependencies in package.json
- Removed .gitlab-ci.yml from the project
- Updated @git.zone/tsbuild from ^2.1.72 to ^2.1.80
- Updated @git.zone/tstest from ^1.0.86 to ^1.0.90
- Updated @push.rocks/tapbundle from ^5.0.15 to ^5.0.23
- Updated @types/node from ^20.11.19 to ^20.14.8
- Updated @push.rocks/lik from ^6.0.12 to ^6.0.15
- Updated dayjs from ^1.11.10 to ^1.11.11
- Fixed test files to export default tap.start()
## 2024-05-29 - 4.0.6 - Maintenance Updates
Updates to configuration files and metadata.
- Updated description in the project documentation.
- Revised tsconfig settings.
- Changes to npmextra.json regarding githost configuration.
## 2023-10-20 - 4.0.5 to 4.0.6 - Maintenance Fixes
Routine fixes and updates.
- fix(core): update
## 2023-08-13 - 4.0.4 to 4.0.5 - Maintenance Fixes
Routine fixes and updates.
- fix(core): update
## 2023-07-21 - 4.0.2 to 4.0.4 - Maintenance Fixes
Routine fixes and updates.
- fix(core): update
## 2023-01-06 - 4.0.0 to 4.0.1 - Core Changes
Routine fixes and core updates.
- fix(core): update
## 2022-11-21 - 3.0.45 to 4.0.0 - Major Release
Significant changes and breaking updates.
- BREAKING CHANGE(core): switch to esm
## 2021-11-08 - 3.0.41 to 3.0.42 - Timestamp Update
Updates and bug fixes for the timestamp feature.
- fix(timestamp): add missing .isOlderThanOtherTimeStamp() to TimeStamp class
- fix(readme): fix readme
- fix(update croner): update croner package, closes #1. Thank you @Hexagon4
## 2020-09-04 - 3.0.28 to 3.0.31 - Maintenance Fixes
Routine fixes and updates.
- fix(core): update
## 2020-07-11 - 3.0.19 to 3.0.20 - Maintenance Fixes
Routine fixes and updates.
- fix(core): update
## 2020-05-25 - 3.0.12 to 3.0.16 - Maintenance Fixes
Routine fixes and updates.
- fix(core): update
## 2019-06-18 - 3.0.8 to 3.0.12 - Maintenance Fixes
Routine fixes and updates.
- fix(core): update
## 2018-10-21 - 3.0.0 to 3.0.1 - Date Handling
Updates to date and time support.
- fix(date): now supports date and time
- fix(ExtendedDate): now respects single digit dates
## 2018-10-17 - 2.0.2 to 3.0.0 - Major Release
Breaking changes and dependency updates.
- BREAKING CHANGE(deps): remove moment and use luxon
## 2018-06-10 - 2.0.0 to 2.0.1 - Core Changes
Updated and changed the scope of core functionalities.
- fix(core): update and change scope
## 2017-08-16 - 1.0.0 to 1.0.3 - Initial Implementation
Inception of project with core functionalities.
- first implementation

View File

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

3
dist/index.d.ts vendored
View File

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

9
dist/index.js vendored
View File

@ -1,9 +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"));
__export(require("./smarttime.units"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUVBLHdEQUFrRDtBQUNsRCxtREFBNkM7QUFDN0MsdUNBQWlDIn0=

View File

@ -1,22 +0,0 @@
/**
* easy high resolution time measurement
*/
export declare class HrtMeasurement {
nanoSeconds: number;
milliSeconds: number;
private _hrTimeStart;
private _hrTimeStopDiff;
private _started;
/**
* start the measurement
*/
start(): void;
/**
* stop the measurement
*/
stop(): this;
/**
* reset the measurement
*/
reset(): void;
}

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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMuaHJ0bWVhc3VyZW1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUuY2xhc3Nlcy5ocnRtZWFzdXJlbWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFrQztBQUVsQzs7R0FFRztBQUNIO0lBQUE7UUFDRSxnQkFBVyxHQUFXLElBQUksQ0FBQTtRQUMxQixpQkFBWSxHQUFXLElBQUksQ0FBQTtRQUNuQixpQkFBWSxHQUFHLElBQUksQ0FBQTtRQUNuQixvQkFBZSxHQUFHLElBQUksQ0FBQTtRQUN0QixhQUFRLEdBQVksS0FBSyxDQUFBO0lBa0NuQyxDQUFDO0lBaENDOztPQUVHO0lBQ0gsS0FBSztRQUNILElBQUksQ0FBQyxRQUFRLEdBQUcsSUFBSSxDQUFBO1FBQ3BCLElBQUksQ0FBQyxZQUFZLEdBQUcsT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFBO0lBQ3RDLENBQUM7SUFFRDs7T0FFRztJQUNILElBQUk7UUFDRixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxLQUFLLEtBQUssQ0FBQyxDQUFDLENBQUM7WUFDNUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxxQkFBcUIsQ0FBQyxDQUFBO1lBQ2xDLE1BQU0sQ0FBQTtRQUNSLENBQUM7UUFDRCxJQUFJLENBQUMsZUFBZSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFBO1FBQ3hELElBQUksQ0FBQyxXQUFXLEdBQUcsQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUMsQ0FBQyxHQUFHLEdBQUcsQ0FBQyxHQUFHLElBQUksQ0FBQyxlQUFlLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDNUUsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUMsV0FBVyxHQUFHLE9BQU8sQ0FBQTtRQUM5QyxNQUFNLENBQUMsSUFBSSxDQUFBO0lBQ2IsQ0FBQztJQUVEOztPQUVHO0lBQ0gsS0FBSztRQUNILElBQUksQ0FBQyxXQUFXLEdBQUcsSUFBSSxDQUFBO1FBQ3ZCLElBQUksQ0FBQyxZQUFZLEdBQUcsSUFBSSxDQUFBO1FBQ3hCLElBQUksQ0FBQyxZQUFZLEdBQUcsSUFBSSxDQUFBO1FBQ3hCLElBQUksQ0FBQyxlQUFlLEdBQUcsSUFBSSxDQUFBO1FBQzNCLElBQUksQ0FBQyxRQUFRLEdBQUcsS0FBSyxDQUFBO0lBQ3ZCLENBQUM7Q0FDRjtBQXZDRCx3Q0F1Q0MifQ==

View File

@ -1,39 +0,0 @@
/**
* TimeStamp
* smart timestamp
*/
export declare 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;
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, compareTimeArg?: number): boolean;
isYoungerThan(TimeStampArg: TimeStamp, compareTimeArg?: number): boolean;
}

View File

@ -1,63 +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, compareTimeArg) {
if (this.milliSeconds < TimeStampArg.milliSeconds &&
(!compareTimeArg ||
(compareTimeArg && ((TimeStampArg.milliSeconds - this.milliSeconds) > compareTimeArg)))) {
return true;
}
else {
return false;
}
}
isYoungerThan(TimeStampArg, compareTimeArg) {
if (this.milliSeconds > TimeStampArg.milliSeconds &&
(!compareTimeArg ||
(compareTimeArg && ((this.milliSeconds - TimeStampArg.milliSeconds) > compareTimeArg)))) {
return true;
}
else {
return false;
}
}
}
exports.TimeStamp = TimeStamp;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNzZXMudGltZXN0YW1wLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR0aW1lLmNsYXNzZXMudGltZXN0YW1wLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUE7OztHQUdHO0FBQ0g7SUFzQkUsWUFBYSxVQUFtQjtRQUxoQzs7V0FFRztRQUNILFdBQU0sR0FBVyxJQUFJLENBQUE7UUFHbkIsRUFBRSxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDO1lBQ2hCLElBQUksQ0FBQyxJQUFJLEdBQUcsSUFBSSxJQUFJLEVBQUUsQ0FBQTtRQUN4QixDQUFDO1FBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDLE9BQU8sVUFBVSxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUM7WUFDMUMsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FBQTtRQUNsQyxDQUFDO1FBQ0QsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO1FBQ3ZDLElBQUksQ0FBQyxTQUFTLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsWUFBWSxHQUFHLElBQUksQ0FBQyxDQUFBO0lBQ3ZELENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBRSxlQUFlO1FBQ3RDLE1BQU0sQ0FBQyxJQUFJLFNBQVMsQ0FBQyxlQUFlLENBQUMsQ0FBQTtJQUN2QyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0gsTUFBTSxDQUFDLGFBQWEsQ0FBRSxZQUF1QjtRQUMzQyxJQUFJLGNBQWMsR0FBRyxJQUFJLFNBQVMsRUFBRSxDQUFBO1FBQ3BDLGNBQWMsQ0FBQyxNQUFNLEdBQUcsY0FBYyxDQUFDLFlBQVksR0FBRyxZQUFZLENBQUMsWUFBWSxDQUFBO1FBQy9FLE1BQU0sQ0FBQyxjQUFjLENBQUE7SUFDdkIsQ0FBQztJQUVEOzs7T0FHRztJQUNILFdBQVcsQ0FBRSxZQUF1QixFQUFFLGNBQXVCO1FBQzNELEVBQUUsQ0FBQyxDQUNELElBQUksQ0FBQyxZQUFZLEdBQUcsWUFBWSxDQUFDLFlBQVk7WUFDN0MsQ0FDRSxDQUFDLGNBQWM7Z0JBQ2YsQ0FDRSxjQUFjLElBQUksQ0FBQyxDQUFDLFlBQVksQ0FBQyxZQUFZLEdBQUcsSUFBSSxDQUFDLFlBQVksQ0FBQyxHQUFHLGNBQWMsQ0FBQyxDQUNyRixDQUVMLENBQUMsQ0FBQyxDQUFDO1lBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQTtRQUNiLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNOLE1BQU0sQ0FBQyxLQUFLLENBQUE7UUFDZCxDQUFDO0lBQ0gsQ0FBQztJQUVELGFBQWEsQ0FBRSxZQUF1QixFQUFFLGNBQXVCO1FBQzdELEVBQUUsQ0FBQyxDQUNELElBQUksQ0FBQyxZQUFZLEdBQUcsWUFBWSxDQUFDLFlBQVk7WUFDN0MsQ0FDRSxDQUFDLGNBQWM7Z0JBQ2YsQ0FDRSxjQUFjLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxZQUFZLEdBQUcsWUFBWSxDQUFDLFlBQVksQ0FBQyxHQUFHLGNBQWMsQ0FBQyxDQUNyRixDQUVMLENBQUMsQ0FBQyxDQUFDO1lBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQTtRQUNiLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNOLE1BQU0sQ0FBQyxLQUFLLENBQUE7UUFDZCxDQUFDO0lBQ0gsQ0FBQztDQUNGO0FBcEZELDhCQW9GQyJ9

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

View File

@ -1,17 +0,0 @@
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

@ -1,48 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.units = {
years: (timesArg = 1) => {
return timesArg * 3154e+10;
},
months: (timesArg = 1) => {
return timesArg * 2628e+9;
},
weeks: (timesArg = 1) => {
return timesArg * 6048e+8;
},
days: (timesArg = 1) => {
return timesArg * 864e+7;
},
hours: (timesArg = 1) => {
return timesArg * 36e+6;
},
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnVuaXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnR0aW1lLnVuaXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQVcsUUFBQSxLQUFLLEdBQUc7SUFDakIsS0FBSyxFQUFFLENBQUMsUUFBUSxHQUFHLENBQUM7UUFDbEIsTUFBTSxDQUFDLFFBQVEsR0FBRyxRQUFRLENBQUE7SUFDNUIsQ0FBQztJQUNELE1BQU0sRUFBRSxDQUFDLFFBQVEsR0FBRyxDQUFDO1FBQ25CLE1BQU0sQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFBO0lBQzNCLENBQUM7SUFDRCxLQUFLLEVBQUUsQ0FBQyxRQUFRLEdBQUcsQ0FBQztRQUNsQixNQUFNLENBQUMsUUFBUSxHQUFHLE9BQU8sQ0FBQTtJQUMzQixDQUFDO0lBQ0QsSUFBSSxFQUFFLENBQUMsUUFBUSxHQUFHLENBQUM7UUFDakIsTUFBTSxDQUFDLFFBQVEsR0FBRyxNQUFNLENBQUE7SUFDMUIsQ0FBQztJQUNELEtBQUssRUFBRSxDQUFDLFFBQVEsR0FBRyxDQUFDO1FBQ2xCLE1BQU0sQ0FBQyxRQUFRLEdBQUcsS0FBSyxDQUFBO0lBQ3pCLENBQUM7SUFDRCxPQUFPLEVBQUUsQ0FBQyxRQUFRLEdBQUcsQ0FBQztRQUNwQixNQUFNLENBQUMsUUFBUSxHQUFHLEtBQUssQ0FBQTtJQUN6QixDQUFDO0NBQ0YsQ0FBQTtBQVdVLFFBQUEsd0JBQXdCLEdBQUcsQ0FBQyxjQUFtQztJQUN4RSxJQUFJLGtCQUFrQixHQUFHLENBQUMsQ0FBQTtJQUMxQixJQUFJLGVBQWUsR0FBRyxDQUFDLGVBQWU7UUFDcEMsa0JBQWtCLEdBQUcsa0JBQWtCLEdBQUcsZUFBZSxDQUFBO0lBQzNELENBQUMsQ0FBQTtJQUNELEVBQUUsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO1FBQUMsZUFBZSxDQUFDLGFBQUssQ0FBQyxLQUFLLENBQUMsY0FBYyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUE7SUFBQyxDQUFDO0lBQ2hGLEVBQUUsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO1FBQUMsZUFBZSxDQUFDLGFBQUssQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUE7SUFBQyxDQUFDO0lBQ25GLEVBQUUsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO1FBQUMsZUFBZSxDQUFDLGFBQUssQ0FBQyxLQUFLLENBQUMsY0FBYyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUE7SUFBQyxDQUFDO0lBQ2hGLEVBQUUsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO1FBQUMsZUFBZSxDQUFDLGFBQUssQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUE7SUFBQyxDQUFDO0lBQzdFLEVBQUUsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO1FBQUMsZUFBZSxDQUFDLGFBQUssQ0FBQyxLQUFLLENBQUMsY0FBYyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUE7SUFBQyxDQUFDO0lBQ2hGLEVBQUUsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1FBQUMsZUFBZSxDQUFDLGFBQUssQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUE7SUFBQyxDQUFDO0lBRXRGLE1BQU0sQ0FBQyxrQkFBa0IsQ0FBQTtBQUMzQixDQUFDLENBQUEifQ==

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)

21
license Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Lossless GmbH (hello@lossless.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,7 +1,29 @@
{
"npmci": {
"globalNpmTools": [
"npmts"
]
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smarttime",
"description": "Provides utilities for advanced time handling including cron jobs, timestamps, intervals, and more.",
"npmPackagename": "@push.rocks/smarttime",
"license": "MIT",
"keywords": [
"time handling",
"cron jobs",
"timestamps",
"time intervals",
"date operations",
"time formatting",
"scheduling"
]
}
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -1,18 +1,63 @@
{
"name": "smarttime",
"version": "1.0.6",
"description": "handle timeformats in smart ways",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"name": "@push.rocks/smarttime",
"private": false,
"version": "4.2.0",
"description": "Provides utilities for advanced time handling including cron jobs, timestamps, intervals, and more.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(npmts)"
"test": "(tstest ./test)",
"build": "(tsbuild --web && tsbundle npm)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"tapbundle": "^1.0.13"
"@git.zone/tsbuild": "^2.2.0",
"@git.zone/tsbundle": "^2.1.0",
"@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.5.3",
"@types/node": "^22.10.2"
},
"dependencies": {
"typings-global": "^1.0.16"
"@push.rocks/lik": "^6.1.0",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartpromise": "^4.0.4",
"croner": "^9.0.0",
"date-fns": "^4.1.0",
"dayjs": "^1.11.13",
"is-nan": "^1.3.2",
"pretty-ms": "^9.2.0"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
],
"type": "module",
"keywords": [
"time handling",
"cron jobs",
"timestamps",
"time intervals",
"date operations",
"time formatting",
"scheduling"
],
"homepage": "https://code.foss.global/push.rocks/smarttime",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smarttime.git"
}
}

10237
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

162
readme.md
View File

@ -1,29 +1,147 @@
# smarttime
handle timeformats in smart ways
# @push.rocks/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/)
## Install
To install `@push.rocks/smarttime`, use the following npm command:
## 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/)
```bash
npm install @push.rocks/smarttime --save
```
This will add `@push.rocks/smarttime` to your project's dependencies.
## Usage
Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
`@push.rocks/smarttime` provides a comprehensive toolkit for handling various aspects of time manipulation, scheduling, and comparison in a TypeScript project. The following sections will guide you through the capabilities of this package, showcasing how to use its classes and functions effectively.
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
### Handling Time Units and Calculations
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
#### Working with Units
```typescript
import { units, getMilliSecondsFromUnits } from '@push.rocks/smarttime';
// Define a duration using a combination of time units
let durationInMilliseconds = getMilliSecondsFromUnits({
years: 1,
months: 2,
weeks: 3,
days: 4,
hours: 5,
minutes: 6,
seconds: 7
});
console.log(`Duration in milliseconds: ${durationInMilliseconds}`);
```
In the example above, we specify a complex duration made up of various time units using the `getMilliSecondsFromUnits` function. This is quite useful for calculations where you need to define durations in a more human-readable format.
### Scheduling with CronManager
`@push.rocks/smarttime` includes a powerful scheduling tool called `CronManager`, which allows you to schedule tasks using cron syntax.
#### Creating and Starting a CronManager
```typescript
import { CronManager } from '@push.rocks/smarttime';
const cronManager = new CronManager();
// Adding a cron job that runs every minute
cronManager.addCronjob('* * * * *', async () => {
console.log('This task runs every minute.');
});
// Starting the CronManager
cronManager.start();
```
The example demonstrates how to create a `CronManager`, add a cron job that runs every minute, and start the scheduling. You can add multiple cron jobs to a single manager, each with its own scheduling and task.
### Working with Extended Date Class
The `ExtendedDate` class extends the native JavaScript `Date` object, providing additional functionality for handling dates in various formats and zones.
#### Creating ExtendedDate Instances
```typescript
import { ExtendedDate } from '@push.rocks/smarttime';
// Creating a date from a European format string
const dateFromEuroString = ExtendedDate.fromEuropeanDate('31.12.2023');
console.log(dateFromEuroString.toString());
// Creating a date from a hyphed date string
const dateFromHyphedString = ExtendedDate.fromHyphedDate('2023-12-31');
console.log(dateFromHyphedString.toString());
```
#### Checking if a Date is Today
```typescript
import { ExtendedDate } from '@push.rocks/smarttime';
const someDate = new ExtendedDate();
console.log(`Is someDate today? ${someDate.isToday()}`);
```
Using `ExtendedDate`, you can also easily check if a given date is today. This simplifies certain date comparisons that are common in web and application development.
### High-Resolution Time Measurement
For performance testing and high-resolution time tracking, `@push.rocks/smarttime` provides the `HrtMeasurement` class.
```typescript
import { HrtMeasurement } from '@push.rocks/smarttime';
const hrtMeasurement = new HrtMeasurement();
hrtMeasurement.start();
// Simulate some operations...
setTimeout(() => {
hrtMeasurement.stop();
console.log(`Operation took ${hrtMeasurement.milliSeconds} milliseconds.`);
}, 1000);
```
This class allows you to measure the duration of operations in your code with high precision, offering both milliseconds and nanoseconds resolutions.
### Interval and Timer functionalities
`@push.rocks/smarttime` includes classes for managing intervals and timers with enhanced control, such as pause, resume, and reset capabilities.
#### Using the Timer class
```typescript
import { Timer } from '@push.rocks/smarttime';
const timer = new Timer(5000); // A 5-second timer
timer.start();
timer.completed.then(() => {
console.log('Timer completed!');
});
// Resetting the timer
timer.reset();
timer.start();
```
The `Timer` class allows for asynchronous waiting in a more object-oriented manner. In the example, a `Timer` is created for five seconds, started, and then reset for demonstration purposes.
### Conclusion
`@push.rocks/smarttime` offers an extensive toolkit for dealing with time in JavaScript and TypeScript applications. Whether you need precise timing, scheduled tasks, or extended date functionalities, this package provides a suite of tools designed to handle time in smart and efficient ways. The examples provided herein demonstrate the core functionalities, aiming to help you integrate time-related features into your projects with ease.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

3
test/ondemand.ts Normal file
View File

@ -0,0 +1,3 @@
import * as smarttime from '../ts/index.js';
console.log(smarttime.getMilliSecondsAsHumanReadableAgoTime(Date.now()));

50
test/test.both.ts Normal file
View File

@ -0,0 +1,50 @@
// tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from '@push.rocks/tapbundle';
import * as smarttime from '../ts/index.js';
// 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).toBeInstanceOf(smarttime.TimeStamp);
expect(testTimeStamp).toBeInstanceOf(smarttime.TimeStamp);
});
tap.test('should have valid linuxtime', async () => {
// tslint:disable-next-line:no-unused-expression
expect(testTimeStamp.isOlderThan(testTimeStamp2)).toBeTrue();
// tslint:disable-next-line:no-unused-expression
expect(testTimeStamp.isYoungerThanOtherTimeStamp(testTimeStamp2)).toBeFalse();
});
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).toBeGreaterThan(19);
expect(testHrtMeasurement.milliSeconds).toBeLessThan(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);
});
export default tap.start();

View File

@ -0,0 +1,60 @@
import { tap, expect } from '@push.rocks/tapbundle';
import * as smarttime from '../ts/index.js';
let testCronManager: smarttime.CronManager;
tap.test('should create a valid instance of cronmanager', async () => {
testCronManager = new smarttime.CronManager();
expect(testCronManager).toBeInstanceOf(smarttime.CronManager);
});
tap.test('should create a valid cronJon', async (tools) => {
const done = tools.defer();
const done2 = tools.defer();
const done3 = tools.defer();
let counter = 0;
let counter2 = 0;
let counter3 = 0;
const cronJob = testCronManager.addCronjob('*/2 * * * * *', async () => {
if (counter === 5) {
testCronManager.removeCronjob(cronJob);
done.resolve();
}
counter++;
console.log(`${new Date().getSeconds()} hey ${counter} -> runs every 2 seconds`);
});
const cronJob2 = testCronManager.addCronjob('*/3 * * * * *', async () => {
if (counter2 === 5) {
testCronManager.removeCronjob(cronJob2);
done2.resolve();
}
counter2++;
console.log(`${new Date().getSeconds()} hey ${counter2} -> runs every 3 seconds`);
});
const cronJob3 = testCronManager.addCronjob('*/4 * * * * *', async () => {
if (counter3 === 5) {
done3.resolve();
}
counter3++;
console.log(`${new Date().getSeconds()} hey ${counter3} -> runs every 4 seconds`);
});
testCronManager.start();
await done.promise;
await done2.promise;
await done3.promise;
testCronManager.stop();
testCronManager.removeCronjob(cronJob3);
});
tap.test('runs every full minute', async (tools) => {
const done = tools.defer();
const cronJob = testCronManager.addCronjob('0 * * * * *', async () => {
done.resolve();
});
testCronManager.start();
await done.promise;
testCronManager.stop();
});
export default tap.start();

View File

@ -0,0 +1,34 @@
import { expect, tap } from '@push.rocks/tapbundle';
import * as smarttime from '../ts/index.js';
tap.test('should create a valid JavaScript Date', async () => {
const extendedDate = new smarttime.ExtendedDate(Date.now());
console.log(extendedDate);
});
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()).toEqual('13.02.2018');
});
tap.test('should format a date', async () => {
const extendedDate = new smarttime.ExtendedDate(Date.now());
console.log(extendedDate.format('YYYY-MM-DD - hh:mm'));
});
export default tap.start();

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

@ -0,0 +1,26 @@
// tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from '@push.rocks/tapbundle';
import { Timer } from '../ts/index.js';
let testTimer: Timer;
tap.test('should create a valid timer', async () => {
testTimer = new Timer(1000);
expect(testTimer).toBeInstanceOf(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;
});
export default tap.start();

View File

@ -1,48 +0,0 @@
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)
})
tap.test('should have valid linuxtime', async () => {
// tslint:disable-next-line:no-unused-expression
expect(testTimeStamp.isOlderThan(testTimeStamp2)).to.be.true
// tslint:disable-next-line:no-unused-expression
expect(testTimeStamp.isYoungerThan(testTimeStamp2)).to.be.false
})
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)
})
// check units
tap.test('should combine units', async () => {
let computedTime = smarttime.getMilliSecondsFromUnits({
years: 2,
months: 2,
weeks: 2,
days: 2,
hours: 2,
minutes: 2
})
console.log(computedTime)
})
tap.start()

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smarttime',
version: '4.2.0',
description: 'Provides utilities for advanced time handling including cron jobs, timestamps, intervals, and more.'
}

View File

@ -1,5 +1,8 @@
import * as plugins from './smarttime.plugins'
export * from './smarttime.classes.hrtmeasurement'
export * from './smarttime.classes.timestamp'
export * from './smarttime.units'
export * from './smarttime.classes.cronmanager.js';
export * from './smarttime.classes.cronjob.js';
export * from './smarttime.classes.extendeddate.js';
export * from './smarttime.classes.hrtmeasurement.js';
export * from './smarttime.classes.interval.js';
export * from './smarttime.classes.timer.js';
export * from './smarttime.classes.timestamp.js';
export * from './smarttime.units.js';

View File

@ -0,0 +1,58 @@
import * as plugins from './smarttime.plugins.js';
import { CronManager } from './smarttime.classes.cronmanager.js';
import { CronParser } from './smarttime.classes.cronparser.js';
export type TJobFunction =
| ((triggerTimeArg?: number) => void)
| ((triggerTimeArg?: number) => Promise<any>);
export class CronJob {
public cronParser: plugins.croner.Cron;
public status: 'started' | 'stopped' | 'initial' = 'initial';
public cronExpression: string;
public jobFunction: TJobFunction;
private nextExecutionUnix: number = 0;
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction) {
this.cronExpression = cronExpressionArg;
this.jobFunction = jobFunction;
this.cronParser = new plugins.croner.Cron(cronExpressionArg);
}
/**
* checks wether the cronjob needs to be executed
*/
public checkExecution(): number {
if (this.nextExecutionUnix === 0) {
this.getNextExecutionTime();
}
if (Date.now() > this.nextExecutionUnix) {
const maybePromise = this.jobFunction(this.nextExecutionUnix);
if (maybePromise instanceof Promise) {
maybePromise.catch((e) => console.log(e));
}
this.nextExecutionUnix = this.getNextExecutionTime();
}
return this.nextExecutionUnix;
}
public getNextExecutionTime() {
return (this.nextExecutionUnix = Date.now() + this.getTimeToNextExecution());
}
/**
* gets the time to next execution
*/
public getTimeToNextExecution() {
return this.cronParser.msToNext();
}
public start() {
this.status = 'started';
}
public stop() {
this.status = 'stopped';
}
}

View File

@ -0,0 +1,86 @@
import * as plugins from './smarttime.plugins.js';
import { CronJob, type TJobFunction } from './smarttime.classes.cronjob.js';
import { getMilliSecondsAsHumanReadableString } from './smarttime.units.js';
export class CronManager {
public executionTimeout: plugins.smartdelay.Timeout<void>;
public status: 'started' | 'stopped' = 'stopped';
public cronjobs = new plugins.lik.ObjectMap<CronJob>();
constructor() {}
public addCronjob(cronIdentifierArg: string, cronFunctionArg: TJobFunction) {
const newCronJob = new CronJob(this, cronIdentifierArg, cronFunctionArg);
this.cronjobs.add(newCronJob);
if (this.status === 'started') {
newCronJob.start();
}
return newCronJob;
}
public removeCronjob(cronjobArg: CronJob) {
cronjobArg.stop();
this.cronjobs.remove(cronjobArg);
}
/**
* starts the cronjob
*/
public start() {
if (this.status !== 'started') {
this.status = 'started';
for (const cronJob of this.cronjobs.getArray()) {
cronJob.start();
}
this.runCronCycle();
}
}
private async runCronCycle() {
this.executionTimeout = new plugins.smartdelay.Timeout(0);
do {
let nextRunningCronjob: CronJob;
for (const cronJob of this.cronjobs.getArray()) {
cronJob.checkExecution();
if (
!nextRunningCronjob ||
cronJob.getTimeToNextExecution() < nextRunningCronjob.getTimeToNextExecution()
) {
nextRunningCronjob = cronJob;
}
}
if (nextRunningCronjob) {
this.executionTimeout = new plugins.smartdelay.Timeout(
nextRunningCronjob.getTimeToNextExecution()
);
console.log(
`Next CronJob scheduled in ${getMilliSecondsAsHumanReadableString(
this.executionTimeout.getTimeLeft()
)}`
);
} else {
this.executionTimeout = new plugins.smartdelay.Timeout(1000);
console.log('no cronjobs specified! Checking again in 1 second');
}
await this.executionTimeout.promise;
} while (this.status === 'started');
};
/**
* stops all cronjobs
*/
public stop() {
if (this.status === 'started') {
this.status = 'stopped';
this.executionTimeout.cancel();
} else {
console.log(`You tried to stop a CronManager that was not actually started.`);
}
for (const cron of this.cronjobs.getArray()) {
cron.stop();
}
}
}

View File

@ -0,0 +1,88 @@
import * as plugins from './smarttime.plugins.js';
export class CronParser {
public cronExpression: string;
public get cronArray() {
return this.cronExpression.split(' ');
}
constructor(cronExpressionArg: string) {
this.cronExpression = cronExpressionArg;
if (this.cronArray.length < 6) {
throw new Error('CronParser needs second level accuracy');
}
}
private getNextPartMatch(cronPart: string, startValue: number, moduloArg: number) {
if (cronPart === '*') {
return startValue;
}
if (cronPart.includes('/')) {
const every = parseInt(cronPart.split('/')[1], 10);
const findEvenMatch = (recursionStartArg: number): number => {
if (recursionStartArg % every === 0) {
return recursionStartArg;
} else {
return findEvenMatch(recursionStartArg + 1);
}
};
return findEvenMatch(startValue);
}
if (parseInt(cronPart, 10) || cronPart === '0') {
const match = parseInt(cronPart, 10);
return match;
}
}
public msToNext() {
const cronArray = this.cronArray;
const secondExpression = cronArray[0];
const minuteExpression = cronArray[1];
const hourExpression = cronArray[2];
const dayExpression = cronArray[3];
const monthExpression = cronArray[4];
const yearExpression = cronArray[5];
let currentDate = new Date();
let currentSecond = currentDate.getSeconds() + 1;
let currentMinute = currentDate.getMinutes();
let currentHour = currentDate.getHours();
let currentDay = currentDate.getDate();
let currentMonth = currentDate.getMonth();
let currentYear = currentDate.getFullYear();
const targetSecond = this.getNextPartMatch(secondExpression, currentSecond, 59);
if (targetSecond < currentSecond) {
currentMinute = (currentMinute + 1) % 59;
}
const targetMinute = this.getNextPartMatch(minuteExpression, currentMinute, 59);
if (targetMinute < currentMinute) {
currentHour = (currentHour + 1) % 23;
}
const targetHour = this.getNextPartMatch(hourExpression, currentHour, 23);
if (targetHour < currentHour) {
currentDay = (currentDay + 1) % 30;
}
const targetDay = currentDay;
if (targetDay < currentDay) {
currentMonth = (currentMonth + 1) % 11;
}
const targetMonth = currentMonth;
if (targetMonth < currentMonth) {
currentYear = currentYear + 1;
}
const targetYear = currentYear;
const targetDate = new Date(
targetYear,
targetMonth,
targetDay,
targetHour,
targetMinute,
targetSecond
);
const targetTime = targetDate.getTime();
return targetTime - Date.now();
}
}

View File

@ -0,0 +1,151 @@
import * as plugins from './smarttime.plugins.js';
import * as units from './smarttime.units.js';
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 date = new Date(
parseFloat(dateArray[3]), // year
parseFloat(dateArray[2]) - 1, // month
parseFloat(dateArray[1]) // day
);
const unixMilli = date.getTime();
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 date = plugins.dayjs(dateTimeString);
const unixMilli = date.toDate().getTime();
return new ExtendedDate(unixMilli);
}
// INSTANCE
public timezone: TAvailableZone;
constructor(unixMilli: number = Date.now()) {
super(unixMilli);
}
//
public exportToEuropeanDate() {
const units = this.exportToUnits();
return `${units.dayString}.${units.monthString}.${units.yearString}`;
}
public exportToHyphedSortableDate() {
const units = this.exportToUnits();
return `${units.yearString}-${units.monthString}-${units.dayString}`;
}
/**
* 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()],
};
}
public format(formatArg: string) {
return plugins.dayjs(this.getTime()).format(formatArg);
}
/**
* boolean checks
*/
public isToday() {
return plugins.dayjs(this.getTime()).isToday();
}
public lessTimePassedToNow(unitArgs: units.IUnitCombinationArg): boolean {
const maxPassedUnixTime = units.getMilliSecondsFromUnits(unitArgs);
const actualPassedUnixTime = Date.now() - this.getTime();
return actualPassedUnixTime < maxPassedUnixTime;
}
public moreTimePassedToNow(unitArgs: units.IUnitCombinationArg) {
return !this.lessTimePassedToNow(unitArgs);
}
}

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 _milliStart: number = null;
private _milliDiff: number = null;
private _started: boolean = false;
/**
* start the measurement
*/
start () {
this._started = true
this._hrTimeStart = process.hrtime()
public start() {
this._started = true;
this._milliStart = Date.now();
}
/**
* 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._milliDiff = Date.now() - this._milliStart;
this.nanoSeconds = this._milliDiff * 1000;
this.milliSeconds = this._milliDiff;
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._milliStart = null;
this._milliDiff = null;
this._started = false;
}
}

View File

@ -0,0 +1,43 @@
import * as plugins from './smarttime.plugins.js';
export class Interval {
public status: 'started' | 'stopped' | 'initial' = 'initial';
private statusAuthorization: any = null;
// timings
public intervalMilliseconds: number;
public nextIntervalMillisenconds: 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.js';
import { TimeStamp } from './smarttime.classes.timestamp.js';
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.Timeout;
// 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,91 +1,100 @@
import * as plugins from './smarttime.plugins'
import * as plugins from './smarttime.plugins.js';
/**
* 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: number) {
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);
}
/**
* returns a boolean for wether the timestamp is older than another timestamp
* @param TimeStampArg
* @param tresholdTimeArg
*/
public isOlderThanOtherTimeStamp(TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) {
if (this.milliSeconds < TimeStampArg.milliSeconds - tresholdTimeArg) {
return true;
} else {
return false;
}
}
/**
* Is the current instance older than the argument
* @param TimeStampArg
*/
isOlderThan (TimeStampArg: TimeStamp, compareTimeArg?: number) {
if (
this.milliSeconds < TimeStampArg.milliSeconds &&
(
!compareTimeArg ||
(
compareTimeArg && ((TimeStampArg.milliSeconds - this.milliSeconds) > compareTimeArg)
)
)
) {
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, compareTimeArg?: number) {
if (
this.milliSeconds > TimeStampArg.milliSeconds &&
(
!compareTimeArg ||
(
compareTimeArg && ((this.milliSeconds - TimeStampArg.milliSeconds) > compareTimeArg)
)
)
) {
return true
/**
* returns a boolean for wether the timestamp is younger than another timestamp
* @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,17 @@
import 'typings-global'
// @pushrocks scope
import * as lik from '@push.rocks/lik';
import * as smartdelay from '@push.rocks/smartdelay';
import * as smartpromise from '@push.rocks/smartpromise';
export { lik, smartdelay, smartpromise };
// third parties;
import * as croner from 'croner';
import * as dateFns from 'date-fns';
import dayjs from 'dayjs';
import isToday from 'dayjs/plugin/isToday.js';
import prettyMs from 'pretty-ms';
dayjs.extend(isToday);
export { croner, dateFns, dayjs, prettyMs };

View File

@ -1,45 +1,73 @@
import * as plugins from './smarttime.plugins.js';
export let units = {
years: (timesArg = 1): number => {
return timesArg * 3154e+10
return timesArg * 3.154e10;
},
months: (timesArg = 1): number => {
return timesArg * 2628e+9
return timesArg * 2.628e9;
},
weeks: (timesArg = 1) => {
return timesArg * 6048e+8
return timesArg * 6.048e8;
},
days: (timesArg = 1) => {
return timesArg * 864e+7
return timesArg * 8.64e7;
},
hours: (timesArg = 1) => {
return timesArg * 36e+6
return timesArg * 3.6e6;
},
minutes: (timesArg = 1) => {
return timesArg * 60000
}
}
return timesArg * 60000;
},
seconds: (timesArg = 1) => {
return timesArg * 1000;
},
};
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;
seconds?: number;
}
export let getMilliSecondsFromUnits = (combinationArg: IUnitCombinationArg) => {
let timeInMilliseconds = 0
let addMilliSeconds = (milliSecondsArg) => {
timeInMilliseconds = timeInMilliseconds + milliSecondsArg
let timeInMilliseconds = 0;
let addMilliSeconds = (milliSecondsArg: number) => {
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.seconds) {
addMilliSeconds(units.seconds(combinationArg.seconds));
}
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;
};
export const getMilliSecondsAsHumanReadableString = (milliSecondsArg: number): string => {
return plugins.prettyMs(milliSecondsArg);
};
export const getMilliSecondsAsHumanReadableAgoTime = (timeStampArg: number): string => {
return plugins.dateFns.formatDistanceToNow(new Date(timeStampArg));
}

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

View File

@ -1,3 +0,0 @@
{
"extends": "tslint-config-standard"
}

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"