-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #524 from swrlab/dev/update-1.1.2
Update v1.1.2
- Loading branch information
Showing
33 changed files
with
839 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
node-utils by SWR audio lab | ||
frequently used node-packages and helpers | ||
*/ | ||
|
||
// import packages | ||
const ard = require('./packages/ard') | ||
const helpers = require('./packages/helpers') | ||
const numbers = require('./packages/numbers') | ||
const storage = require('./packages/storage-wrapper') | ||
const strings = require('./packages/strings') | ||
const undici = require('./packages/undici') | ||
|
||
// export packages | ||
module.exports = { | ||
ard, | ||
helpers, | ||
numbers, | ||
storage, | ||
strings, | ||
undici, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"name": "@swrlab/utils", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Wrapping common SWR Audio Lab utils", | ||
"main": "./src/index.js", | ||
"main": "./index.js", | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
|
@@ -16,19 +16,20 @@ | |
"ard:publishers": "node -r dotenv/config scripts/ard/publishers.js", | ||
"ard:pub-sort": "node -r dotenv/config scripts/ard/sortPubByExtId.js", | ||
"lint": "eslint .", | ||
"test": "mocha test/test.js -r dotenv/config", | ||
"test": "mocha tests/**.js -r dotenv/config", | ||
"reinstall": "rm -rf node_modules && rm yarn.lock && yarn" | ||
}, | ||
"author": "SWR Audio Lab <[email protected]>", | ||
"license": "MIT", | ||
"private": false, | ||
"dependencies": { | ||
"@google-cloud/storage": "^6.9.2", | ||
"@google-cloud/storage": "^6.9.3", | ||
"abort-controller": "^3.0.0", | ||
"aws-sdk": "^2.1313.0", | ||
"aws-sdk": "^2.1318.0", | ||
"chai": "^4.3.7", | ||
"luxon": "^3.2.1", | ||
"node-crc": "swrlab/node-crc#v2.1.0", | ||
"undici": "^5.19.1", | ||
"undici": "^5.20.0", | ||
"uuid": "9.0.0" | ||
}, | ||
"devDependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# SWR Audio Lab / Date | ||
|
||
Date functions and time helpers. | ||
|
||
- [SWR Audio Lab / Date](#swr-audio-lab--date) | ||
- [Install](#install) | ||
- [`getDateHourMinutes` - get date with hours and minutes](#getdatehourminutes---get-date-with-hours-and-minutes) | ||
- [`getDayMonthYear` - get date with month and year](#getdaymonthyear---get-date-with-month-and-year) | ||
- [`getFullRelativeTime` - get full date with relative years](#getfullrelativetime---get-full-date-with-relative-years) | ||
- [`getHourMinutes` - get hours and minutes from iso date](#gethourminutes---get-hours-and-minutes-from-iso-date) | ||
- [`getIsoRelativeTime` - get iso date with relative years](#getisorelativetime---get-iso-date-with-relative-years) | ||
- [`getRelativeTime` - get relative years from iso date](#getrelativetime---get-relative-years-from-iso-date) | ||
- [`getYearMonthDay` - get YYYYMMDD from iso date](#getyearmonthday---get-yyyymmdd-from-iso-date) | ||
- [`revYearMonthDay` - get DDMMYYYY from YYYYMMDD](#revyearmonthday---get-ddmmyyyy-from-yyyymmdd) | ||
|
||
## Install | ||
|
||
Add the parent package to your dependencies: | ||
|
||
```sh | ||
yarn add @swrlab/utils | ||
``` | ||
|
||
## `getDateHourMinutes` - get date with hours and minutes | ||
|
||
- `value` (required) - Date as ISO string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { getDateHourMinutes } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
getDateHourMinutes('2038-01-19T03:14:08.000') | ||
// 'Di, 19. Januar 2038 - 03:14 Uhr' | ||
``` | ||
|
||
## `getDayMonthYear` - get date with month and year | ||
|
||
- `value` (required) - Date as ISO string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { getDayMonthYear } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
getDayMonthYear('2038-01-19T03:14:08.000') | ||
// 'Di, 19. Januar 2038' | ||
``` | ||
|
||
## `getFullRelativeTime` - get full date with relative years | ||
|
||
- `value` (required) - Date as ISO string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { getFullRelativeTime } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
getFullRelativeTime('2038-01-19T03:14:08.000') | ||
// 'Di, 19. Januar 2038 - 03:14 Uhr (in YY Jahren)' | ||
``` | ||
|
||
## `getHourMinutes` - get hours and minutes from iso date | ||
|
||
- `value` (required) - Date as ISO string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { getHourMinutes } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
getHourMinutes('2038-01-19T03:14:08.000') | ||
// '03:14' | ||
``` | ||
|
||
## `getIsoRelativeTime` - get iso date with relative years | ||
|
||
- `value` (required) - Date as ISO string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { getIsoRelativeTime } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
getIsoRelativeTime('2038-01-19T03:14:08.000') | ||
// '2038-01-19T03:14:08.000 (in YY Jahren)' | ||
``` | ||
|
||
## `getRelativeTime` - get relative years from iso date | ||
|
||
- `value` (required) - Date as ISO string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { getRelativeTime } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
getRelativeTime('2038-01-19T03:14:08.000') | ||
// '(in YY Jahren)' | ||
``` | ||
|
||
## `getYearMonthDay` - get YYYYMMDD from iso date | ||
|
||
- `value` (required) - Date as ISO string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { getYearMonthDay } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
getYearMonthDay('2038-01-19T03:14:08.000') | ||
// '20380119' | ||
``` | ||
|
||
## `revYearMonthDay` - get DDMMYYYY from YYYYMMDD | ||
|
||
- `value` (required) - Date as `YYYYMMDD` string | ||
|
||
Import the library: | ||
|
||
```js | ||
const { revYearMonthDay } = require('@swrlab/utils/packages/date') | ||
``` | ||
|
||
Then use the toolkit: | ||
|
||
```js | ||
revYearMonthDay('20380119') | ||
// '19012038' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// import packages | ||
const getDateHourMinutes = require('../../utils/date/getDateHourMinutes') | ||
const getDayMonthYear = require('../../utils/date/getDayMonthYear') | ||
const getFullRelativeTime = require('../../utils/date/getFullRelativeTime') | ||
const getHourMinutes = require('../../utils/date/getHourMinutes') | ||
const getIsoRelativeTime = require('../../utils/date/getIsoRelativeTime') | ||
const getRelativeTime = require('../../utils/date/getRelativeTime') | ||
const getYearMonthDay = require('../../utils/date/getYearMonthDay') | ||
const revYearMonthDay = require('../../utils/date/revYearMonthDay') | ||
|
||
// export packages | ||
module.exports = { | ||
getDateHourMinutes, | ||
getDayMonthYear, | ||
getFullRelativeTime, | ||
getHourMinutes, | ||
getIsoRelativeTime, | ||
getRelativeTime, | ||
getYearMonthDay, | ||
revYearMonthDay, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
// import packages | ||
const arrayToObjectCount = require('../../utils/helpers/arrayToObjectCount') | ||
const getJsonKeys = require('../../utils/helpers/getJsonKeys') | ||
const sleep = require('../../utils/helpers/sleep') | ||
|
||
// export packages | ||
module.exports = { | ||
arrayToObjectCount, | ||
getJsonKeys, | ||
sleep, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.