Skip to content

Commit

Permalink
Merge pull request #493 from swrlab/dev/update
Browse files Browse the repository at this point in the history
Update v1.1.0
  • Loading branch information
rafaelmaeuer authored Dec 20, 2022
2 parents d50a43b + be94699 commit 55ad55b
Show file tree
Hide file tree
Showing 17 changed files with 514 additions and 326 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test

on:
workflow_dispatch:
push:
branches:
- chore/*
- feat/*
- dev/*
- main

jobs:
test:
name: Run Mocha Tests
runs-on: ubuntu-latest
steps:
- name: 👀 Checkout Code
uses: actions/checkout@v3

- name: ⛺️ Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

- name: 📦 Install Dependencies
run: yarn

- name: 🧪 Run Tests
run: yarn lint && yarn test
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,67 @@ by [**SWR Audio Lab**](https://lab.swr.de/)

## Changelog

- 2022-12-19 - v1.1.0
- feat: add test workflow to github/actions
- feat: add helpers package (with `sleep` function)
- feat: add numbers package (with `toReadable` function)
- feat: add `capitalize` and `pluralize` functions in strings package
- chore!: move `isEven` from strings to numbers package

BREAKING CHANGE: `strings.isEven()` is deprecated, use `numbers.isEven()` instead

- 2022-08-09 - v1.0.1
- chore: update `super-linter` with new config

- 2022-07-27 - v1.0.0
- chore: move node-crc to swrlab account
- feat: add mocha tests for strings utils

- 2022-07-26 - v1.0.10-beta
- chore: merge `frytg/undici-wrapper` into this package

- 2022-07-06 - v1.0.9-beta
- chore: update undici to v0.1.0 (with fix for `undici.request` instead of `Pool`)

- 2022-06-30 - v1.0.8-beta
- feat: add `isEven` to string helpers

- 2022-06-29 - v1.0.7-beta
- fix: node-crc fork (linux-musl binaries)

- 2022-06-28 - v1.0.6-beta
- feat: mocha test for node-crc
- fix: node-crc fork (prebuild binaries)
- fix: github-actions workflow

- 2022-06-21 - v1.0.5-beta
- chore: update GitHub actions to use latest versions

- 2022-05-03 - v1.0.4-beta
- chore: update GitHub actions

- 2022-03-02 - v1.0.3-beta
- chore: change license to `MIT`
- chore: required Node.js is `v16`

- 2022-01-31 - v1.0.2-beta
- fix: ard publisher script
- add: script for publisher ordering

- 2022-01-31 - v1.0.1-beta
- feat: add string helpers

- 2022-01-26 - v1.0.0-beta
- chore!: folder migration
- refactor: swap node-fetch for undici
- feat: add ard publisher script
- feat: add ard category parser

- 2021-08-11 - v0.2.3
- updated dependencies
- updated GitHub actions
- add optional 'resumable' flag

- 2021-06-21 - v0.2.2
- updated dependencies
- updated GitHub actions
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Then run the desired script.
## Packages

- [ARD](./packages/ard) - Common internal ARD tools like ID creation
- [Helpers](./packages/helpers) - Common functions and helpers
- [Numbers](./packages/numbers) - Common number and math helpers
- [Storage Wrapper](./packages/storage-wrapper) - A utility to wrap file access to local, Google Cloud Storage and AWS S3 file storage
- [Strings](./packages/strings) - Common string, array, object encoding and getter helpers
- [Undici](./packages/undici) - Provides the latest install of [`undici-wrapper`](https://github.com/frytg/undici-wrapper), a wrapper around the [`undici`](https://undici.nodejs.org/) HTTP library
Expand Down Expand Up @@ -96,4 +98,4 @@ A separate Changelog is available in [CHANGELOG.md](CHANGELOG.md)

## License

See [LICENSE.md](LICENSE.md)
See [LICENSE.txt](LICENSE.txt)
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swrlab/utils",
"version": "1.0.1",
"version": "1.1.0",
"description": "Wrapping common SWR Audio Lab utils",
"main": "./src/index.js",
"engines": {
Expand All @@ -15,29 +15,30 @@
"ard:categories": "node -r dotenv/config scripts/ard/categories.js",
"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",
"reinstall": "rm -rf node_modules && rm yarn.lock && yarn"
},
"author": "SWR Audio Lab <[email protected]>",
"license": "MIT",
"private": false,
"dependencies": {
"@google-cloud/storage": "^6.3.0",
"@google-cloud/storage": "^6.8.0",
"abort-controller": "^3.0.0",
"aws-sdk": "^2.1190.0",
"chai": "^4.3.6",
"node-crc": "swrlab/node-crc#v2.0.15",
"undici": "^5.8.2",
"uuid": "8.3.2"
"aws-sdk": "^2.1277.0",
"chai": "^4.3.7",
"node-crc": "swrlab/node-crc#v2.1.0",
"undici": "^5.14.0",
"uuid": "9.0.0"
},
"devDependencies": {
"@swrlab/eslint-plugin-swr": "^0.2.0",
"@swrlab/swr-prettier-config": "^0.2.0",
"dotenv": "^16.0.1",
"eslint": "^8.21.0",
"dotenv": "^16.0.3",
"eslint": "^8.30.0",
"eslint-plugin-json": "^3.1.0",
"mocha": "^10.0.0",
"prettier": "^2.7.1"
"mocha": "^10.2.0",
"prettier": "^2.8.1"
},
"prettier": "@swrlab/swr-prettier-config"
}
32 changes: 32 additions & 0 deletions packages/helpers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SWR Audio Lab / Helpers

Common functions and helpers.

- [SWR Audio Lab / Helpers](#swr-audio-lab--helpers)
- [Install](#install)
- [`sleep` - sleep a given time (async)](#sleep---sleep-a-given-time-async)

## Install

Add the parent package to your dependencies:

```sh
yarn add @swrlab/utils
```

## `sleep` - sleep a given time (async)

- `value` (required) - Value to sleep (in ms)

Import the library:

```js
const { sleep } = require('@swrlab/utils/packages/helpers')
```

Then use the toolkit:

```js
await sleep(1e3)
// will sleep 1s
```
7 changes: 7 additions & 0 deletions packages/helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// import packages
const sleep = require('../../utils/helpers/sleep')

// export packages
module.exports = {
sleep,
}
53 changes: 53 additions & 0 deletions packages/numbers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# SWR Audio Lab / Numbers

Common number and math helpers.

- [SWR Audio Lab / Numbers](#swr-audio-lab--numbers)
- [Install](#install)
- [`isEven` - check if a value is even](#iseven---check-if-a-value-is-even)
- [`toReadable` - get a number in readable format](#toreadable---get-a-number-in-readable-format)

## Install

Add the parent package to your dependencies:

```sh
yarn add @swrlab/utils
```

## `isEven` - check if a value is even

- `value` (required) - Value to check

Import the library:

```js
const { isEven } = require('@swrlab/utils/packages/numbers')
```

Then use the toolkit:

```js
isEven(2)
// true

isEven(1)
// false
```

## `toReadable` - get a number in readable format

- `value` (required) - Value to convert

Import the library:

```js
const { toReadable } = require('@swrlab/utils/packages/numbers')
```

Then use the toolkit:

```js
toReadable(1234567)
// 1.234.567
```
9 changes: 9 additions & 0 deletions packages/numbers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// import packages
const isEven = require('../../utils/numbers/isEven')
const toReadable = require('../../utils/numbers/toReadable')

// export packages
module.exports = {
isEven,
toReadable,
}
66 changes: 45 additions & 21 deletions packages/strings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ Common string, array, object encoding and getter helpers.

- [SWR Audio Lab / Strings, Arrays, Objects](#swr-audio-lab--strings-arrays-objects)
- [Install](#install)
- [`capitalize` - get capitalized string](#capitalize---get-capitalized-string)
- [`getObjectLength` - get the length of an object](#getobjectlength---get-the-length-of-an-object)
- [`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)
- [`isEven` - check if a value is even](#iseven---check-if-a-value-is-even)
- [`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)
- [`isUndefined` - check if a value is undefined](#isundefined---check-if-a-value-is-undefined)
- [`notEmptyArray` - check if a value is not an empty array](#notemptyarray---check-if-a-value-is-not-an-empty-array)
- [`notEmptyObject` - check if a value is not an empty object](#notemptyobject---check-if-a-value-is-not-an-empty-object)
- [`notNullOrUndefined` - check if a value is neither null nor undefined](#notnullorundefined---check-if-a-value-is-neither-null-nor-undefined)
- [`pluralize` - get pluralized string](#pluralize---get-pluralized-string)
- [`removeDoubleSpaces` - take a string and remove its duplicate spaces](#removedoublespaces---take-a-string-and-remove-its-duplicate-spaces)
- [`toHex` - take a string convert it to a hex string](#tohex---take-a-string-convert-it-to-a-hex-string)

Expand All @@ -27,6 +28,23 @@ Add the parent package to your dependencies:
yarn add @swrlab/utils
```

## `capitalize` - get capitalized string

- `value` (required) - Value to capitalize

Import the library:

```js
const { capitalize } = require('@swrlab/utils/packages/strings')
```

Then use the toolkit:

```js
capitalize('apple')
// Apple
```

## `getObjectLength` - get the length of an object

- `value` (required) - Value to check
Expand Down Expand Up @@ -107,26 +125,6 @@ isEmptyObject({ hello: 'world' })
// false
```

## `isEven` - check if a value is even

- `value` (required) - Value to check

Import the library:

```js
const { isEven } = require('@swrlab/utils/packages/strings')
```

Then use the toolkit:

```js
isEven(2)
// true

isEven(1)
// false
```

## `isIncluded` - check if a value (haystack) includes another value (needle)

- `haystack` (required) - Array or value to check
Expand Down Expand Up @@ -271,6 +269,32 @@ notNullOrUndefined(undefined)
// false
```

## `pluralize` - get pluralized string

- `value` (required) - Value to pluralize

Import the library:

```js
const { pluralize } = require('@swrlab/utils/packages/strings')
```

Then use the toolkit:

```js
pluralize(1, 'Apple')
// 1 Apple

pluralize(2, 'Apple')
// 2 Apples

pluralize(1, 'Child', 'Children')
// 1 Child

pluralize(2, 'Child', 'Children')
// 2 Children
```

## `removeDoubleSpaces` - take a string and remove its duplicate spaces

- `value` (required) - Value to convert
Expand Down
Loading

0 comments on commit 55ad55b

Please sign in to comment.