diff --git a/CHANGELOG.md b/CHANGELOG.md index f188e46..856bc9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ by [**SWR Audio Lab**](https://lab.swr.de/) ## Changelog +- 2023-02-15 - v1.1.2 + - feat: add `revYearMonthDay` to date package + - feat: add `date` package with iso time functions + - feat: add `arrayToObjectCount` to helpers package + - feat: add `getJsonKeys` to helpers package + - feat: add `normalize` to numbers package + - feat: add `isEmptyString` to strings package + - 2023-02-13 - v1.1.1 - feat: add `addTrailingZeros` to numbers package - feat: add `addLeadingZero` to numbers package diff --git a/README.md b/README.md index f35dfc2..daf12ce 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ const undici = require('@swrlab/utils/packages/undici') Scripts are meant to be run locally, therefore clone the repository and first install dependencies. We prefer `yarn` for this: ```sh -yarn install +yarn install @swrlab/utils ``` Then run the desired script. diff --git a/index.js b/index.js new file mode 100644 index 0000000..d388bbb --- /dev/null +++ b/index.js @@ -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, +} diff --git a/package.json b/package.json index d2cd891..122ad93 100644 --- a/package.json +++ b/package.json @@ -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 ", "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": { diff --git a/packages/date/README.md b/packages/date/README.md new file mode 100644 index 0000000..f85a0b6 --- /dev/null +++ b/packages/date/README.md @@ -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' +``` diff --git a/packages/date/index.js b/packages/date/index.js new file mode 100644 index 0000000..4ab424e --- /dev/null +++ b/packages/date/index.js @@ -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, +} diff --git a/packages/helpers/README.md b/packages/helpers/README.md index 8321300..586e6b6 100644 --- a/packages/helpers/README.md +++ b/packages/helpers/README.md @@ -4,6 +4,8 @@ Common functions and helpers. - [SWR Audio Lab / Helpers](#swr-audio-lab--helpers) - [Install](#install) + - [`arrayToObjectCount` - reduce array elements to object with count](#arraytoobjectcount---reduce-array-elements-to-object-with-count) + - [`getJsonKeys` - get all keys of json input](#getjsonkeys---get-all-keys-of-json-input) - [`sleep` - sleep a given time (async)](#sleep---sleep-a-given-time-async) ## Install @@ -14,6 +16,40 @@ Add the parent package to your dependencies: yarn add @swrlab/utils ``` +## `arrayToObjectCount` - reduce array elements to object with count + +- `value` (required) - Array to get entries from + +Import the library: + +```js +const { arrayToObjectCount } = require('@swrlab/utils/packages/helpers') +``` + +Then use the toolkit: + +```js +arrayToObjectCount(['foo', 'bar', 'bar']) +// { bar: 2, foo: 1 } +``` + +## `getJsonKeys` - get all keys of json input + +- `value` (required) - Json to get keys from + +Import the library: + +```js +const { getJsonKeys } = require('@swrlab/utils/packages/helpers') +``` + +Then use the toolkit: + +```js +getJsonKeys({ hello: 'world', foo: 'bar' }) +// ['hello', 'foo'] +``` + ## `sleep` - sleep a given time (async) - `value` (required) - Value to sleep (in ms) diff --git a/packages/helpers/index.js b/packages/helpers/index.js index 8e78484..8efd1c2 100644 --- a/packages/helpers/index.js +++ b/packages/helpers/index.js @@ -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, } diff --git a/packages/numbers/README.md b/packages/numbers/README.md index 1aea59f..b3c2999 100644 --- a/packages/numbers/README.md +++ b/packages/numbers/README.md @@ -11,6 +11,7 @@ Common number and math helpers. - [`getRandomInRange` - get random int between min and max](#getrandominrange---get-random-int-between-min-and-max) - [`getSum` - get sum from array of numbers](#getsum---get-sum-from-array-of-numbers) - [`isEven` - check if a value is even](#iseven---check-if-a-value-is-even) + - [`normalize` - normalize a value by given maximum](#normalize---normalize-a-value-by-given-maximum) - [`roundTo` - round float to a specified decimal place](#roundto---round-float-to-a-specified-decimal-place) - [`toReadable` - get a number in readable format](#toreadable---get-a-number-in-readable-format) @@ -180,6 +181,27 @@ isEven(1) // false ``` +## `normalize` - normalize a value by given maximum + +- `value` (required) - Value to normalize +- `max` (required) - Maximum for normalization + +Import the library: + +```js +const { normalize } = require('@swrlab/utils/packages/numbers') +``` + +Then use the toolkit: + +```js +normalize(2, 100) +// 0.02 + +normalize(80, 100) +// 0.8 +``` + ## `roundTo` - round float to a specified decimal place - `value` (required) - Float value to round diff --git a/packages/numbers/index.js b/packages/numbers/index.js index 88a69f7..4a0c2e4 100644 --- a/packages/numbers/index.js +++ b/packages/numbers/index.js @@ -6,6 +6,7 @@ const getDiff = require('../../utils/numbers/getDiff') const getRandomInRange = require('../../utils/numbers/getRandomInRange') const getSum = require('../../utils/numbers/getSum') const isEven = require('../../utils/numbers/isEven') +const normalize = require('../../utils/numbers/normalize') const roundTo = require('../../utils/numbers/roundTo') const toReadable = require('../../utils/numbers/toReadable') @@ -18,6 +19,7 @@ module.exports = { getRandomInRange, getSum, isEven, + normalize, roundTo, toReadable, } diff --git a/packages/strings/README.md b/packages/strings/README.md index 3ea6882..b898dc2 100644 --- a/packages/strings/README.md +++ b/packages/strings/README.md @@ -9,6 +9,7 @@ Common string, array, object encoding and getter helpers. - [`isArray` - check if a value is a proper array](#isarray---check-if-a-value-is-a-proper-array) - [`isEmptyArray` - check if a value is an empty array](#isemptyarray---check-if-a-value-is-an-empty-array) - [`isEmptyObject` - check if a value is an empty object](#isemptyobject---check-if-a-value-is-an-empty-object) + - [`isEmptyString` - check if a value is an empty string](#isemptystring---check-if-a-value-is-an-empty-string) - [`isIncluded` - check if a value (haystack) includes another value (needle)](#isincluded---check-if-a-value-haystack-includes-another-value-needle) - [`isNull` - check if a value is null](#isnull---check-if-a-value-is-null) - [`isObject` - check if a value is a proper object](#isobject---check-if-a-value-is-a-proper-object) @@ -125,6 +126,26 @@ isEmptyObject({ hello: 'world' }) // false ``` +## `isEmptyString` - check if a value is an empty string + +- `value` (required) - Value to check + +Import the library: + +```js +const { isEmptyString } = require('@swrlab/utils/packages/strings') +``` + +Then use the toolkit: + +```js +isEmptyString('') +// true + +isEmptyString('hello world') +// false +``` + ## `isIncluded` - check if a value (haystack) includes another value (needle) - `haystack` (required) - Array or value to check diff --git a/packages/strings/index.js b/packages/strings/index.js index 7938408..d33f6f3 100644 --- a/packages/strings/index.js +++ b/packages/strings/index.js @@ -4,6 +4,7 @@ const getObjectLength = require('../../utils/strings/getObjectLength') const isArray = require('../../utils/strings/isArray') const isEmptyArray = require('../../utils/strings/isEmptyArray') const isEmptyObject = require('../../utils/strings/isEmptyObject') +const isEmptyString = require('../../utils/strings/isEmptyString') const isIncluded = require('../../utils/strings/isIncluded') const isNull = require('../../utils/strings/isNull') const isObject = require('../../utils/strings/isObject') @@ -22,6 +23,7 @@ module.exports = { isArray, isEmptyArray, isEmptyObject, + isEmptyString, isIncluded, isNull, isObject, diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f355039..0000000 --- a/test/test.js +++ /dev/null @@ -1,305 +0,0 @@ -/* eslint-disable sonarjs/no-duplicate-string */ -/* - - by SWR audio lab - simple tests with mocha and chai - -*/ - -// Add eslint exceptions for chai -/* global describe it */ - -const { expect } = require('chai') -const createHashedId = require('../utils/ard/createHashedId') -const helpers = require('../packages/helpers') -const numbers = require('../packages/numbers') -const strings = require('../packages/strings') - -// Test ARD Package -describe('Test ARD Package', () => { - describe('Test ARD-CoreID Hash', () => { - it('createHashedId("test") = 0c171b2e54a30c11', () => { - expect(createHashedId('test')).to.equal('0c171b2e54a30c11') - }) - }) -}) - -// Test Helpers Package -describe('Test Helpers Package', () => { - describe('Test sleep', () => { - it('sleep(1e3) will sleep 1s', async () => { - const time = 1e3 - const before = Date.now() - await helpers.sleep(time) - const after = Date.now() - expect(after - before).to.be.greaterThanOrEqual(time) - }) - }) -}) - -// Test Numbers Package -describe('Test Numbers Package', () => { - describe('Test addLeadingZero', () => { - it("addLeadingZero(1) = '01'", () => { - expect(numbers.addLeadingZero(1)).to.equal('01') - }) - - it("addLeadingZero(10) = '10'", () => { - expect(numbers.addLeadingZero(10)).to.equal('10') - }) - }) - - describe('Test addTrailingZeros', () => { - it("addTrailingZeros(1, 5) = '1.00000'", () => { - expect(numbers.addTrailingZeros(1, 5)).to.equal('1.00000') - }) - - it("addTrailingZeros(1.1, 5) = '1.10000'", () => { - expect(numbers.addTrailingZeros(1.1, 5)).to.equal('1.10000') - }) - - it("addTrailingZeros('1.2', 5) = '1.20000'", () => { - expect(numbers.addTrailingZeros('1.2', 5)).to.equal('1.20000') - }) - - it("addTrailingZeros(2, 2, ',') = '2,00'", () => { - expect(numbers.addTrailingZeros(2, 2, ',')).to.equal('2,00') - }) - - it("addTrailingZeros(2.1, 2, ',') = '2,10'", () => { - expect(numbers.addTrailingZeros(2.1, 2, ',')).to.equal('2,10') - }) - - it("addTrailingZeros('2,2', 2, ','') = '2,20'", () => { - expect(numbers.addTrailingZeros('2,2', 2, ',')).to.equal('2,20') - }) - }) - - describe('Test getAverage', () => { - it('getAverage([1, 2, 3]) = 2', () => { - expect(numbers.getAverage([1, 2, 3])).to.equal(2) - }) - - it('getAverage([1.2, 2.4, 3.6], 1) = 2.4', () => { - expect(numbers.getAverage([1.2, 2.4, 3.6], 1)).to.equal(2.4) - }) - }) - - describe('Test getDiff', () => { - it('getDiff(2, 1) = 1', () => { - expect(numbers.getDiff(2, 1)).to.equal(1) - }) - - it('getDiff(1, 2) = -1', () => { - expect(numbers.getDiff(1, 2)).to.equal(-1) - }) - }) - - describe('Test getRandomInRange', () => { - it('getRandomInRange(1, 5) = 1,2,3,4 or 5', () => { - expect([1, 2, 3, 4, 5]).to.include(numbers.getRandomInRange(1, 5)) - }) - - it('getRandomInRange(5, 9) = 5,6,7,8 or 9', () => { - expect([5, 6, 7, 8, 9]).to.include(numbers.getRandomInRange(5, 9)) - }) - }) - - describe('Test getSum', () => { - it('getSum([1, 2, 3]) = 6', () => { - expect(numbers.getSum([1, 2, 3])).to.equal(6) - }) - - it('getSum([1.2, 2.4, 3.6], 1) = 7.2', () => { - expect(numbers.getSum([1.2, 2.4, 3.6], 1)).to.equal(7.2) - }) - }) - - describe('Test isEven', () => { - it('isEven(2) = true', () => { - expect(numbers.isEven(2)).to.equal(true) - }) - - it('isEven(1) = false', () => { - expect(numbers.isEven(1)).to.equal(false) - }) - }) - - describe('Test roundTo', () => { - it('roundTo(1.23456) = 1.23', () => { - expect(numbers.roundTo(1.23456)).to.equal(1.23) - }) - - it('roundTo(1.23456, 4) = 1.2346', () => { - expect(numbers.roundTo(1.23456, 4)).to.equal(1.2346) - }) - }) - - describe('Test toReadable', () => { - it("toReadable(1234567) = '1.234.567'", () => { - expect(numbers.toReadable(1234567)).to.equal('1.234.567') - }) - }) -}) - -// Test Strings Package -describe('Test Strings Package', () => { - describe('Test capitalize', () => { - it('capitalize("a") = A', () => { - expect(strings.capitalize('a')).to.equal('A') - }) - it('capitalize("apple") = Apple', () => { - expect(strings.capitalize('apple')).to.equal('Apple') - }) - }) - - describe('Test getObjectLength', () => { - it('getObjectLength({ hello: "world" }) = 1', () => { - expect(strings.getObjectLength({ hello: 'world' })).to.equal(1) - }) - - it('getObjectLength({ hello: "world", foo: "bar" }) = 2', () => { - expect(strings.getObjectLength({ hello: 'world', foo: 'bar' })).to.equal(2) - }) - }) - - describe('Test isArray', () => { - it('isArray(["hello world"]) = true', () => { - expect(strings.isArray(['hello world'])).to.equal(true) - }) - - it('isArray({ hello: "world" }) = false', () => { - expect(strings.isArray({ hello: 'world' })).to.equal(false) - }) - }) - - describe('Test isEmptyArray', () => { - it('isEmptyArray([]) = true', () => { - expect(strings.isEmptyArray([])).to.equal(true) - }) - - it('isEmptyArray(["hello world"]) = false', () => { - expect(strings.isEmptyArray(['hello world'])).to.equal(false) - }) - }) - - describe('Test isEmptyObject', () => { - it('isEmptyObject({}) = true', () => { - expect(strings.isEmptyObject({})).to.equal(true) - }) - - it('isEmptyObject({ hello: "world" }) = false', () => { - expect(strings.isEmptyObject({ hello: 'world' })).to.equal(false) - }) - }) - - describe('Test isIncluded', () => { - it('isIncluded("hello world", "hello") = true', () => { - expect(strings.isIncluded('hello world', 'hello')).to.equal(true) - }) - - it('isIncluded("hello world", "earth") = false', () => { - expect(strings.isIncluded('hello world', 'earth')).to.equal(false) - }) - }) - - describe('Test isNull', () => { - it('isNull(null) = true', () => { - expect(strings.isNull(null)).to.equal(true) - }) - - it('isNull(undefined) = false', () => { - expect(strings.isNull(undefined)).to.equal(false) - }) - }) - - describe('Test isObject', () => { - it('isObject({ hello: "world" }) = true', () => { - expect(strings.isObject({ hello: 'world' })).to.equal(true) - }) - - it('isObject("hello world") = false', () => { - expect(strings.isObject('hello world')).to.equal(false) - }) - }) - - describe('Test isUndefined', () => { - it('isUndefined(undefined) = true', () => { - expect(strings.isUndefined(undefined)).to.equal(true) - }) - - it('isUndefined(null) = false', () => { - expect(strings.isUndefined(null)).to.equal(false) - }) - }) - - describe('Test notEmptyArray', () => { - it('notEmptyArray(["hello world"]) = true', () => { - expect(strings.notEmptyArray(['hello world'])).to.equal(true) - }) - - it('notEmptyArray([]) = false', () => { - expect(strings.notEmptyArray([])).to.equal(false) - }) - }) - - describe('Test notEmptyObject', () => { - it('notEmptyObject({ hello: "world" }) = true', () => { - expect(strings.notEmptyObject({ hello: 'world' })).to.equal(true) - }) - - it('notEmptyObject({}) = false', () => { - expect(strings.notEmptyObject({})).to.equal(false) - }) - }) - - describe('Test notNullOrUndefined', () => { - it('notNullOrUndefined("hello world") = true', () => { - expect(strings.notNullOrUndefined('hello world')).to.equal(true) - }) - - it('notNullOrUndefined(null) = false', () => { - expect(strings.notNullOrUndefined(null)).to.equal(false) - }) - - it('notNullOrUndefined(undefined) = false', () => { - expect(strings.notNullOrUndefined(undefined)).to.equal(false) - }) - }) - - describe('Test pluralize', () => { - it('pluralize(1, "Apple") = 1 Apple', () => { - expect(strings.pluralize(1, 'Apple')).to.equal('1 Apple') - }) - - it('pluralize(2, "Apple") = 2 Apples', () => { - expect(strings.pluralize(2, 'Apple')).to.equal('2 Apples') - }) - - it('pluralize(1, "Child", "Children") = 1 Child', () => { - expect(strings.pluralize(1, 'Child', 'Children')).to.equal('1 Child') - }) - - it('pluralize(2, "Child", "Children") = 2 Children', () => { - expect(strings.pluralize(2, 'Child', 'Children')).to.equal('2 Children') - }) - }) - - describe('Test removeDoubleSpaces', () => { - it('removeDoubleSpaces("hello world")) = hello world', () => { - expect(strings.removeDoubleSpaces('hello world')).to.equal('hello world') - }) - - it('removeDoubleSpaces("hello world once again")) = hello world once again', () => { - expect(strings.removeDoubleSpaces('hello world once again')).to.equal( - 'hello world once again' - ) - }) - }) - - describe('Test toHex', () => { - it('toHex("hello world")) = 68656c6c6f20776f726c64', () => { - expect(strings.toHex('hello world')).to.equal('68656c6c6f20776f726c64') - }) - }) -}) diff --git a/tests/ard.js b/tests/ard.js new file mode 100644 index 0000000..921e5ac --- /dev/null +++ b/tests/ard.js @@ -0,0 +1,21 @@ +/* + + by SWR Audio Lab + tests with mocha and chai + +*/ + +// Add eslint exceptions for chai +/* global describe it */ + +const { expect } = require('chai') +const { createHashedId } = require('../packages/ard') + +// Test ARD Package +describe('Test ARD Package', () => { + describe('Test ARD-CoreID Hash', () => { + it("createHashedId('test') = 0c171b2e54a30c11", () => { + expect(createHashedId('test')).to.equal('0c171b2e54a30c11') + }) + }) +}) diff --git a/tests/date.js b/tests/date.js new file mode 100644 index 0000000..b31ca8c --- /dev/null +++ b/tests/date.js @@ -0,0 +1,76 @@ +/* + + by SWR Audio Lab + tests with mocha and chai + +*/ + +// Add eslint exceptions for chai +/* global describe it */ + +const { expect } = require('chai') +const date = require('../packages/date') + +const testDate = '2038-01-19T03:14:08.000' +const relativeTime = 2147483647000 - new Date().getTime() +const relativeYears = parseInt(relativeTime / (1000 * 60 * 60 * 24 * 365), 10) + +// Test DateTime Package +describe('Test DateTime Package', () => { + describe('Test getDateHourMinutes', () => { + const testResult = 'Di, 19. Januar 2038 - 03:14 Uhr' + it(`getDateHourMinutes('${testDate}') = '${testResult}'`, () => { + expect(date.getDateHourMinutes(testDate)).to.equal(testResult) + }) + }) + + describe('Test getDayMonthYear', () => { + const testResult = 'Di, 19. Januar 2038' + it(`getDayMonthYear('${testDate}') = '${testResult}'`, () => { + expect(date.getDayMonthYear(testDate)).to.equal(testResult) + }) + }) + + describe('Test getFullRelativeTime', () => { + const testResult = `Di, 19. Januar 2038 - 03:14 Uhr (in ${relativeYears} Jahren)` + it(`getFullRelativeTime('${testDate}') = '${testResult}'`, () => { + expect(date.getFullRelativeTime(testDate)).to.equal(testResult) + }) + }) + + describe('Test getHourMinutes', () => { + const testResult = '03:14' + it(`getHourMinutes('${testDate}') = '${testResult}'`, () => { + expect(date.getHourMinutes(testDate)).to.equal(testResult) + }) + }) + + describe('Test getIsoRelativeTime', () => { + const testResult = `${testDate} (in ${relativeYears} Jahren)` + it(`getIsoRelativeTime('${testDate}') = '${testResult}'`, () => { + expect(date.getIsoRelativeTime(testDate)).to.equal(testResult) + }) + }) + + describe('Test getRelativeTime', () => { + const testResult = `in ${relativeYears} Jahren` + it(`getRelativeTime('${testDate}') = '${testResult}'`, () => { + expect(date.getRelativeTime(testDate)).to.equal(testResult) + }) + }) + + describe('Test getYearMonthDay', () => { + const testResult = '20380119' + it(`getYearMonthDay('${testDate}') = '${testResult}'`, () => { + expect(date.getYearMonthDay(testDate)).to.equal(testResult) + }) + }) + + describe('Test revYearMonthDay', () => { + const test = '20380119' + const testResult = '19012038' + it(`revYearMonthDay('${test}') = '${testResult}'`, () => { + expect(date.revYearMonthDay(test)).to.equal(testResult) + }) + }) +}) diff --git a/tests/helpers.js b/tests/helpers.js new file mode 100644 index 0000000..fb5b436 --- /dev/null +++ b/tests/helpers.js @@ -0,0 +1,45 @@ +/* + + by SWR Audio Lab + tests with mocha and chai + +*/ + +// Add eslint exceptions for chai +/* global describe it */ + +const { expect } = require('chai') +const helpers = require('../packages/helpers') + +// Test Helpers Package +describe('Test Helpers Package', () => { + describe('Test arrayToObjectCount', () => { + it("arrayToObjectCount(['foo', 'bar', 'bar']) = { bar: 2, foo: 1 }", () => { + const test = ['foo', 'bar', 'bar'] + const result = { bar: 2, foo: 1 } + const testResult = helpers.arrayToObjectCount(test) + expect(testResult.bar).to.equal(result.bar) + expect(testResult.foo).to.equal(result.foo) + }) + }) + + describe('Test getJsonKeys', () => { + it("getJsonKeys({ hello: 'world', foo: 'bar' }) = ['hello', 'foo']", () => { + const test = { hello: 'world', foo: 'bar' } + const result = ['hello', 'foo'] + const testResult = helpers.getJsonKeys(test) + expect(testResult[0]).to.equal(result[0]) + expect(testResult[1]).to.equal(result[1]) + }) + }) + + describe('Test sleep', () => { + it('sleep(1e3) will sleep 1s', async () => { + const time = 1e3 + const before = Date.now() + await helpers.sleep(time) + const after = Date.now() + expect(after - before).to.be.greaterThanOrEqual(time) + }) + }) +}) diff --git a/tests/numbers.js b/tests/numbers.js new file mode 100644 index 0000000..518fcc2 --- /dev/null +++ b/tests/numbers.js @@ -0,0 +1,128 @@ +/* eslint-disable sonarjs/no-duplicate-string */ +/* + + by SWR Audio Lab + tests with mocha and chai + +*/ + +// Add eslint exceptions for chai +/* global describe it */ + +const { expect } = require('chai') +const numbers = require('../packages/numbers') + +// Test Numbers Package +describe('Test Numbers Package', () => { + describe('Test addLeadingZero', () => { + it("addLeadingZero(1) = '01'", () => { + expect(numbers.addLeadingZero(1)).to.equal('01') + }) + + it("addLeadingZero(10) = '10'", () => { + expect(numbers.addLeadingZero(10)).to.equal('10') + }) + }) + + describe('Test addTrailingZeros', () => { + it("addTrailingZeros(1, 5) = '1.00000'", () => { + expect(numbers.addTrailingZeros(1, 5)).to.equal('1.00000') + }) + + it("addTrailingZeros(1.1, 5) = '1.10000'", () => { + expect(numbers.addTrailingZeros(1.1, 5)).to.equal('1.10000') + }) + + it("addTrailingZeros('1.2', 5) = '1.20000'", () => { + expect(numbers.addTrailingZeros('1.2', 5)).to.equal('1.20000') + }) + + it("addTrailingZeros(2, 2, ',') = '2,00'", () => { + expect(numbers.addTrailingZeros(2, 2, ',')).to.equal('2,00') + }) + + it("addTrailingZeros(2.1, 2, ',') = '2,10'", () => { + expect(numbers.addTrailingZeros(2.1, 2, ',')).to.equal('2,10') + }) + + it("addTrailingZeros('2,2', 2, ','') = '2,20'", () => { + expect(numbers.addTrailingZeros('2,2', 2, ',')).to.equal('2,20') + }) + }) + + describe('Test getAverage', () => { + it('getAverage([1, 2, 3]) = 2', () => { + expect(numbers.getAverage([1, 2, 3])).to.equal(2) + }) + + it('getAverage([1.2, 2.4, 3.6], 1) = 2.4', () => { + expect(numbers.getAverage([1.2, 2.4, 3.6], 1)).to.equal(2.4) + }) + }) + + describe('Test getDiff', () => { + it('getDiff(2, 1) = 1', () => { + expect(numbers.getDiff(2, 1)).to.equal(1) + }) + + it('getDiff(1, 2) = -1', () => { + expect(numbers.getDiff(1, 2)).to.equal(-1) + }) + }) + + describe('Test getRandomInRange', () => { + it('getRandomInRange(1, 5) = 1,2,3,4 or 5', () => { + expect([1, 2, 3, 4, 5]).to.include(numbers.getRandomInRange(1, 5)) + }) + + it('getRandomInRange(5, 9) = 5,6,7,8 or 9', () => { + expect([5, 6, 7, 8, 9]).to.include(numbers.getRandomInRange(5, 9)) + }) + }) + + describe('Test getSum', () => { + it('getSum([1, 2, 3]) = 6', () => { + expect(numbers.getSum([1, 2, 3])).to.equal(6) + }) + + it('getSum([1.2, 2.4, 3.6], 1) = 7.2', () => { + expect(numbers.getSum([1.2, 2.4, 3.6], 1)).to.equal(7.2) + }) + }) + + describe('Test isEven', () => { + it('isEven(2) = true', () => { + expect(numbers.isEven(2)).to.equal(true) + }) + + it('isEven(1) = false', () => { + expect(numbers.isEven(1)).to.equal(false) + }) + }) + + describe('Test normalize', () => { + it('normalize(2, 100) = 0.02', () => { + expect(numbers.normalize(2, 100)).to.equal(0.02) + }) + + it('normalize(80, 100) = 0.8', () => { + expect(numbers.normalize(80, 100)).to.equal(0.8) + }) + }) + + describe('Test roundTo', () => { + it('roundTo(1.23456) = 1.23', () => { + expect(numbers.roundTo(1.23456)).to.equal(1.23) + }) + + it('roundTo(1.23456, 4) = 1.2346', () => { + expect(numbers.roundTo(1.23456, 4)).to.equal(1.2346) + }) + }) + + describe('Test toReadable', () => { + it("toReadable(1234567) = '1.234.567'", () => { + expect(numbers.toReadable(1234567)).to.equal('1.234.567') + }) + }) +}) diff --git a/tests/strings.js b/tests/strings.js new file mode 100644 index 0000000..8616ba8 --- /dev/null +++ b/tests/strings.js @@ -0,0 +1,185 @@ +/* eslint-disable sonarjs/no-duplicate-string */ +/* + + by SWR Audio Lab + tests with mocha and chai + +*/ + +// Add eslint exceptions for chai +/* global describe it */ + +const { expect } = require('chai') +const strings = require('../packages/strings') + +// Test Strings Package +describe('Test Strings Package', () => { + describe('Test capitalize', () => { + it("capitalize('a') = 'A'", () => { + expect(strings.capitalize('a')).to.equal('A') + }) + it("capitalize('apple') = 'Apple'", () => { + expect(strings.capitalize('apple')).to.equal('Apple') + }) + }) + + describe('Test getObjectLength', () => { + it("getObjectLength({ hello: 'world' }) = 1", () => { + expect(strings.getObjectLength({ hello: 'world' })).to.equal(1) + }) + + it("getObjectLength({ hello: 'world', foo: 'bar' }) = 2", () => { + expect(strings.getObjectLength({ hello: 'world', foo: 'bar' })).to.equal(2) + }) + }) + + describe('Test isArray', () => { + it("isArray(['hello world']) = true", () => { + expect(strings.isArray(['hello world'])).to.equal(true) + }) + + it("isArray({ hello: 'world' }) = false", () => { + expect(strings.isArray({ hello: 'world' })).to.equal(false) + }) + }) + + describe('Test isEmptyArray', () => { + it('isEmptyArray([]) = true', () => { + expect(strings.isEmptyArray([])).to.equal(true) + }) + + it("isEmptyArray(['hello world']) = false", () => { + expect(strings.isEmptyArray(['hello world'])).to.equal(false) + }) + }) + + describe('Test isEmptyObject', () => { + it('isEmptyObject({}) = true', () => { + expect(strings.isEmptyObject({})).to.equal(true) + }) + + it("isEmptyObject({ hello: 'world' }) = false", () => { + expect(strings.isEmptyObject({ hello: 'world' })).to.equal(false) + }) + }) + + describe('Test isEmptyString', () => { + it("isEmptyString('') = true", () => { + expect(strings.isEmptyString('')).to.equal(true) + }) + + it("isEmptyString('hello world') = false", () => { + expect(strings.isEmptyString('hello world')).to.equal(false) + }) + }) + + describe('Test isIncluded', () => { + it("isIncluded('hello world', 'hello') = true", () => { + expect(strings.isIncluded('hello world', 'hello')).to.equal(true) + }) + + it("isIncluded('hello world', 'earth') = false", () => { + expect(strings.isIncluded('hello world', 'earth')).to.equal(false) + }) + }) + + describe('Test isNull', () => { + it('isNull(null) = true', () => { + expect(strings.isNull(null)).to.equal(true) + }) + + it('isNull(undefined) = false', () => { + expect(strings.isNull(undefined)).to.equal(false) + }) + }) + + describe('Test isObject', () => { + it("isObject({ hello: 'world' }) = true", () => { + expect(strings.isObject({ hello: 'world' })).to.equal(true) + }) + + it("isObject('hello world') = false", () => { + expect(strings.isObject('hello world')).to.equal(false) + }) + }) + + describe('Test isUndefined', () => { + it('isUndefined(undefined) = true', () => { + expect(strings.isUndefined(undefined)).to.equal(true) + }) + + it('isUndefined(null) = false', () => { + expect(strings.isUndefined(null)).to.equal(false) + }) + }) + + describe('Test notEmptyArray', () => { + it("notEmptyArray(['hello world']) = true", () => { + expect(strings.notEmptyArray(['hello world'])).to.equal(true) + }) + + it('notEmptyArray([]) = false', () => { + expect(strings.notEmptyArray([])).to.equal(false) + }) + }) + + describe('Test notEmptyObject', () => { + it("notEmptyObject({ hello: 'world' }) = true", () => { + expect(strings.notEmptyObject({ hello: 'world' })).to.equal(true) + }) + + it('notEmptyObject({}) = false', () => { + expect(strings.notEmptyObject({})).to.equal(false) + }) + }) + + describe('Test notNullOrUndefined', () => { + it("notNullOrUndefined('hello world') = true", () => { + expect(strings.notNullOrUndefined('hello world')).to.equal(true) + }) + + it('notNullOrUndefined(null) = false', () => { + expect(strings.notNullOrUndefined(null)).to.equal(false) + }) + + it('notNullOrUndefined(undefined) = false', () => { + expect(strings.notNullOrUndefined(undefined)).to.equal(false) + }) + }) + + describe('Test pluralize', () => { + it("pluralize(1, 'Apple') = '1 Apple'", () => { + expect(strings.pluralize(1, 'Apple')).to.equal('1 Apple') + }) + + it("pluralize(2, 'Apple') = '2 Apples'", () => { + expect(strings.pluralize(2, 'Apple')).to.equal('2 Apples') + }) + + it("pluralize(1, 'Child', 'Children') = '1 Child'", () => { + expect(strings.pluralize(1, 'Child', 'Children')).to.equal('1 Child') + }) + + it("pluralize(2, 'Child', 'Children') = '2 Children'", () => { + expect(strings.pluralize(2, 'Child', 'Children')).to.equal('2 Children') + }) + }) + + describe('Test removeDoubleSpaces', () => { + it("removeDoubleSpaces('hello world')) = 'hello world'", () => { + expect(strings.removeDoubleSpaces('hello world')).to.equal('hello world') + }) + + it("removeDoubleSpaces('hello world once again')) = 'hello world once again'", () => { + expect(strings.removeDoubleSpaces('hello world once again')).to.equal( + 'hello world once again' + ) + }) + }) + + describe('Test toHex', () => { + it("toHex('hello world')) = '68656c6c6f20776f726c64'", () => { + expect(strings.toHex('hello world')).to.equal('68656c6c6f20776f726c64') + }) + }) +}) diff --git a/utils/ard/createHashedId.js b/utils/ard/createHashedId.js index 35bb79c..ae2b1a2 100644 --- a/utils/ard/createHashedId.js +++ b/utils/ard/createHashedId.js @@ -1,6 +1,6 @@ /* - by SWR audio lab + by SWR Audio Lab this file creates a CRC64-ECMA182-compliant hash based on an utf-8 encoded input string diff --git a/utils/date/getDateHourMinutes.js b/utils/date/getDateHourMinutes.js new file mode 100644 index 0000000..fcc9704 --- /dev/null +++ b/utils/date/getDateHourMinutes.js @@ -0,0 +1,5 @@ +const { DateTime } = require('luxon') + +// returns 'Di, 19. Januar 2038 - 03:14 Uhr' +const dayHourMinutes = 'ccc, d. LLLL yyyy - HH:mm' +module.exports = (date) => `${DateTime.fromISO(date).setLocale('de').toFormat(dayHourMinutes)} Uhr` diff --git a/utils/date/getDayMonthYear.js b/utils/date/getDayMonthYear.js new file mode 100644 index 0000000..cc387c8 --- /dev/null +++ b/utils/date/getDayMonthYear.js @@ -0,0 +1,4 @@ +const { DateTime } = require('luxon') + +// returns 'Do, 1. Januar 1970' +module.exports = (date) => DateTime.fromISO(date).setLocale('de').toFormat('ccc, d. LLLL yyyy') diff --git a/utils/date/getFullRelativeTime.js b/utils/date/getFullRelativeTime.js new file mode 100644 index 0000000..edcab2d --- /dev/null +++ b/utils/date/getFullRelativeTime.js @@ -0,0 +1,5 @@ +const getDateHourMinutes = require('./getDateHourMinutes') +const getRelativeTime = require('./getRelativeTime') + +// returns 'Do, 1. Januar 1970 - 00:00 Uhr (in YY Jahren)' +module.exports = (date) => `${getDateHourMinutes(date)} (${getRelativeTime(date)})` diff --git a/utils/date/getHourMinutes.js b/utils/date/getHourMinutes.js new file mode 100644 index 0000000..5a3fa3f --- /dev/null +++ b/utils/date/getHourMinutes.js @@ -0,0 +1,4 @@ +const { DateTime } = require('luxon') + +// get hours and minutes (returns '12:34') +module.exports = (date) => DateTime.fromISO(date).toFormat('HH:mm') diff --git a/utils/date/getIsoRelativeTime.js b/utils/date/getIsoRelativeTime.js new file mode 100644 index 0000000..57a8656 --- /dev/null +++ b/utils/date/getIsoRelativeTime.js @@ -0,0 +1,4 @@ +const getRelativeTime = require('./getRelativeTime') + +// get iso date with relative years +module.exports = (date) => `${date} (${getRelativeTime(date)})` diff --git a/utils/date/getRelativeTime.js b/utils/date/getRelativeTime.js new file mode 100644 index 0000000..0df4aa8 --- /dev/null +++ b/utils/date/getRelativeTime.js @@ -0,0 +1,4 @@ +const { DateTime } = require('luxon') + +// get relative years (returns 'in YY Jahren') +module.exports = (date) => DateTime.fromISO(date).setLocale('de').toRelative() diff --git a/utils/date/getYearMonthDay.js b/utils/date/getYearMonthDay.js new file mode 100644 index 0000000..1b778a8 --- /dev/null +++ b/utils/date/getYearMonthDay.js @@ -0,0 +1,4 @@ +const { DateTime } = require('luxon') + +// get YYYYMMDD (returns '19700101') +module.exports = (date) => DateTime.fromISO(date).setLocale('de').toFormat('yyyyLLdd') diff --git a/utils/date/revYearMonthDay.js b/utils/date/revYearMonthDay.js new file mode 100644 index 0000000..b80e671 --- /dev/null +++ b/utils/date/revYearMonthDay.js @@ -0,0 +1,7 @@ +// get DDMMYYYY from YYYYMMDD +module.exports = (date) => { + const year = date.substring(0, 4) + const month = date.substring(4, 6) + const day = date.substring(6, 8) + return `${day}${month}${year}` +} diff --git a/utils/helpers/arrayToObjectCount.js b/utils/helpers/arrayToObjectCount.js new file mode 100644 index 0000000..fe6ef00 --- /dev/null +++ b/utils/helpers/arrayToObjectCount.js @@ -0,0 +1,8 @@ +// reduce array elements to object with count +module.exports = (array) => { + return array.reduce((obj, name) => { + // eslint-disable-next-line no-plusplus + obj[name] = obj[name] ? ++obj[name] : 1 + return obj + }, {}) +} diff --git a/utils/helpers/getJsonKeys.js b/utils/helpers/getJsonKeys.js new file mode 100644 index 0000000..43b1f14 --- /dev/null +++ b/utils/helpers/getJsonKeys.js @@ -0,0 +1,10 @@ +// get all keys of given json +module.exports = (json) => { + const keys = [] + for (const key in json) { + if ({}.hasOwnProperty.call(json, key)) { + keys.push(key) + } + } + return keys +} diff --git a/utils/numbers/normalize.js b/utils/numbers/normalize.js new file mode 100644 index 0000000..0cd910a --- /dev/null +++ b/utils/numbers/normalize.js @@ -0,0 +1,2 @@ +// normalize value by division of a maximum value +module.exports = (value, maximumValue) => value / maximumValue diff --git a/utils/strings/isEmptyString.js b/utils/strings/isEmptyString.js new file mode 100644 index 0000000..7d1045f --- /dev/null +++ b/utils/strings/isEmptyString.js @@ -0,0 +1,2 @@ +// check if a variable is an empty string +module.exports = (value) => value === '' diff --git a/utils/undici/index.js b/utils/undici/index.js index d69334c..e424968 100644 --- a/utils/undici/index.js +++ b/utils/undici/index.js @@ -1,6 +1,6 @@ /* - SWR Audio Lab + by SWR Audio Lab this file runs the undici-wrapper util diff --git a/yarn.lock b/yarn.lock index 8419f2e..2021b10 100644 --- a/yarn.lock +++ b/yarn.lock @@ -56,10 +56,10 @@ resolved "https://registry.yarnpkg.com/@google-cloud/promisify/-/promisify-3.0.1.tgz#8d724fb280f47d1ff99953aee0c1669b25238c2e" integrity sha512-z1CjRjtQyBOYL+5Qr9DdYIfrdLBe746jRTYfaYU6MeXkqp7UfYs/jX16lFFVzZ7PGEJvqZNqYUEtb1mvDww4pA== -"@google-cloud/storage@^6.9.2": - version "6.9.2" - resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-6.9.2.tgz#f620c22aa817d3459035adeb23b89342ece60dc3" - integrity sha512-TIQ6G+QzHb/hR/7AIH4OU+z8fXqCLM7JiqO+nGxw61os4YxCWPD2ajW+pzz7VY5k2VtqzhoMFA6rjIfw39wJmQ== +"@google-cloud/storage@^6.9.3": + version "6.9.3" + resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-6.9.3.tgz#43fa4c9e30785313f68d01e6fde9bdba6d10a695" + integrity sha512-ucbHoDvjXlcR/DrJNQlCFnQSaO7pXHTPGs3Gt2TQtPQ+b7Y6DR0ztIt/CEeH+O03I41g9e+T2N1SOOVq5UyaKQ== dependencies: "@google-cloud/paginator" "^3.0.7" "@google-cloud/projectify" "^3.0.0" @@ -283,10 +283,10 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -aws-sdk@^2.1313.0: - version "2.1313.0" - resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1313.0.tgz#e6dad914670fb3f4d5cd95c58413fca5ea5c6c86" - integrity sha512-8GMdtV2Uch3HL2c6+P3lNZFTcg/fqq9L3EWYRLb6ljCZvWKTssjdkjSJFDyTReNgeiKV224YRPYQbKpOEz4flQ== +aws-sdk@^2.1318.0: + version "2.1318.0" + resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1318.0.tgz#a633c82a51d0572805f744b51ca04a3babf6c909" + integrity sha512-xRCKqx4XWXUIpjDCVHmdOSINEVCIC5+yhmgUGR9A6VfxfPs59HbxKyd5LB+CmXhVbwVUM4SRWG5O+agQj+w7Eg== dependencies: buffer "4.9.2" events "1.1.1" @@ -1644,6 +1644,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +luxon@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.2.1.tgz#14f1af209188ad61212578ea7e3d518d18cee45f" + integrity sha512-QrwPArQCNLAKGO/C+ZIilgIuDnEnKx5QYODdDtbFaxzsbZcc/a7WFq7MhsVYgRlwawLtvOUESTlfJ+hc/USqPg== + mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" @@ -2364,10 +2369,10 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici@^5.19.1: - version "5.19.1" - resolved "https://registry.yarnpkg.com/undici/-/undici-5.19.1.tgz#92b1fd3ab2c089b5a6bd3e579dcda8f1934ebf6d" - integrity sha512-YiZ61LPIgY73E7syxCDxxa3LV2yl3sN8spnIuTct60boiiRaE1J8mNWHO8Im2Zi/sFrPusjLlmRPrsyraSqX6A== +undici@^5.20.0: + version "5.20.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.20.0.tgz#6327462f5ce1d3646bcdac99da7317f455bcc263" + integrity sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g== dependencies: busboy "^1.6.0"