From a6c3d4a0f6165c591808138dccc2e02051a8cf63 Mon Sep 17 00:00:00 2001 From: Ben Grant Date: Thu, 20 Apr 2023 00:01:37 +1000 Subject: [PATCH 1/4] Move aggregate functions and constants to math folder --- lib/main.ts | 3 +-- lib/{ => math}/constants.ts | 0 lib/math/index.ts | 3 +++ lib/{aggregation.ts => math/product.ts} | 4 ---- lib/math/sum.ts | 3 +++ 5 files changed, 7 insertions(+), 6 deletions(-) rename lib/{ => math}/constants.ts (100%) create mode 100644 lib/math/index.ts rename lib/{aggregation.ts => math/product.ts} (52%) create mode 100644 lib/math/sum.ts diff --git a/lib/main.ts b/lib/main.ts index 51f3ddd..7310aa3 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -1,8 +1,7 @@ export * from './arrays' export * from './errors' export * from './objects' -export * from './constants' -export * from './aggregation' +export * from './math' export * from './promises' export * from './strings' export * from './interpolation' diff --git a/lib/constants.ts b/lib/math/constants.ts similarity index 100% rename from lib/constants.ts rename to lib/math/constants.ts diff --git a/lib/math/index.ts b/lib/math/index.ts new file mode 100644 index 0000000..99f91bf --- /dev/null +++ b/lib/math/index.ts @@ -0,0 +1,3 @@ +export * from './sum' +export * from './product' +export * from './constants' diff --git a/lib/aggregation.ts b/lib/math/product.ts similarity index 52% rename from lib/aggregation.ts rename to lib/math/product.ts index ba70736..22607e2 100644 --- a/lib/aggregation.ts +++ b/lib/math/product.ts @@ -1,7 +1,3 @@ -/** Adds the two operands */ -export const sum = (a: number, b: number): number => - a + b - /** Multiplies the two operands */ export const product = (a: number, b: number): number => a * b diff --git a/lib/math/sum.ts b/lib/math/sum.ts new file mode 100644 index 0000000..6f36f64 --- /dev/null +++ b/lib/math/sum.ts @@ -0,0 +1,3 @@ +/** Adds the two operands */ +export const sum = (a: number, b: number): number => + a + b From c5b4430da8f62e96376f82c5a48dae89c16c4922 Mon Sep 17 00:00:00 2001 From: Ben Grant Date: Thu, 20 Apr 2023 00:08:40 +1000 Subject: [PATCH 2/4] Add docs using typedoc --- README.md | 6 ++ docs/.nojekyll | 1 + docs/README.md | 50 +++++++++++++++ docs/arrays/arrays.md | 20 ++++++ docs/arrays/functions/function.chunkArray.md | 50 +++++++++++++++ .../arrays/functions/function.dedupArrayBy.md | 44 +++++++++++++ .../arrays/functions/function.groupArrayBy.md | 61 +++++++++++++++++++ .../functions/function.partitionArray.md | 38 ++++++++++++ docs/arrays/functions/function.range.md | 46 ++++++++++++++ docs/arrays/functions/function.zipArrays.md | 50 +++++++++++++++ .../functions/function.zipArraysLongest.md | 58 ++++++++++++++++++ docs/arrays/types/type-alias.Zipped.md | 15 +++++ docs/arrays/types/type-alias.ZippedLongest.md | 16 +++++ docs/errors/errors.md | 9 +++ .../functions/function.expectOrThrow.md | 49 +++++++++++++++ docs/interpolation/functions/function.lerp.md | 46 ++++++++++++++ docs/interpolation/interpolation.md | 9 +++ docs/math/functions/function.product.md | 22 +++++++ docs/math/functions/function.sum.md | 22 +++++++ docs/math/math.md | 17 ++++++ docs/math/variables/variable.EARTH_GRAVITY.md | 9 +++ docs/math/variables/variable.GOLDEN_RATIO.md | 9 +++ .../variables/variable.JUPITER_GRAVITY.md | 9 +++ docs/math/variables/variable.TAU.md | 9 +++ docs/modules.md | 15 +++++ docs/objects/functions/function.getKey.md | 47 ++++++++++++++ .../functions/function.mergeObjectValuesBy.md | 39 ++++++++++++ docs/objects/objects.md | 10 +++ .../functions/function.filterAsync.md | 36 +++++++++++ docs/promises/functions/function.mapAsync.md | 37 +++++++++++ .../functions/function.resolveObject.md | 47 ++++++++++++++ docs/promises/promises.md | 11 ++++ docs/strings/functions/function.capitalize.md | 35 +++++++++++ .../functions/function.editDistance.md | 31 ++++++++++ docs/strings/functions/function.pluralize.md | 50 +++++++++++++++ .../function.truncateWithEllipsis.md | 50 +++++++++++++++ docs/strings/strings.md | 12 ++++ package.json | 3 + yarn.lock | 57 +++++++++++++++++ 39 files changed, 1145 insertions(+) create mode 100644 docs/.nojekyll create mode 100644 docs/README.md create mode 100644 docs/arrays/arrays.md create mode 100644 docs/arrays/functions/function.chunkArray.md create mode 100644 docs/arrays/functions/function.dedupArrayBy.md create mode 100644 docs/arrays/functions/function.groupArrayBy.md create mode 100644 docs/arrays/functions/function.partitionArray.md create mode 100644 docs/arrays/functions/function.range.md create mode 100644 docs/arrays/functions/function.zipArrays.md create mode 100644 docs/arrays/functions/function.zipArraysLongest.md create mode 100644 docs/arrays/types/type-alias.Zipped.md create mode 100644 docs/arrays/types/type-alias.ZippedLongest.md create mode 100644 docs/errors/errors.md create mode 100644 docs/errors/functions/function.expectOrThrow.md create mode 100644 docs/interpolation/functions/function.lerp.md create mode 100644 docs/interpolation/interpolation.md create mode 100644 docs/math/functions/function.product.md create mode 100644 docs/math/functions/function.sum.md create mode 100644 docs/math/math.md create mode 100644 docs/math/variables/variable.EARTH_GRAVITY.md create mode 100644 docs/math/variables/variable.GOLDEN_RATIO.md create mode 100644 docs/math/variables/variable.JUPITER_GRAVITY.md create mode 100644 docs/math/variables/variable.TAU.md create mode 100644 docs/modules.md create mode 100644 docs/objects/functions/function.getKey.md create mode 100644 docs/objects/functions/function.mergeObjectValuesBy.md create mode 100644 docs/objects/objects.md create mode 100644 docs/promises/functions/function.filterAsync.md create mode 100644 docs/promises/functions/function.mapAsync.md create mode 100644 docs/promises/functions/function.resolveObject.md create mode 100644 docs/promises/promises.md create mode 100644 docs/strings/functions/function.capitalize.md create mode 100644 docs/strings/functions/function.editDistance.md create mode 100644 docs/strings/functions/function.pluralize.md create mode 100644 docs/strings/functions/function.truncateWithEllipsis.md create mode 100644 docs/strings/strings.md diff --git a/README.md b/README.md index 91dc1e6..7641a1a 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ import { pluralize } from '@giraugh/tools' pluralize('cake', 2) === 'cakes' ``` +## Documentation + +**[πŸ“„ Visit documentation](/docs/modules.md)** + +Docs are auto generated based on TSDoc comments. See the full API docs above for a list of tools and constants you can use. + ## Development If you find an issue or want to request a feature, please [create an issue](https://github.com/giraugh/tools/issues/new/choose). diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e2ac661 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..635d593 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,50 @@ +# πŸ¦’ Giraugh Tools + +[![npm version](https://img.shields.io/npm/v/@giraugh/tools)](https://www.npmjs.com/package/@giraugh/tools) +[![minzip size](https://img.shields.io/bundlephobia/minzip/@giraugh/tools)](https://bundlephobia.com/package/@giraugh/tools) + +Generic typescript utilities built with simplicity in mind. + +## Installation + +**Yarn** + +```bash +yarn add @giraugh/tools +``` + +**PNPM** + +```bash +pnpm add @giraugh/tools +``` + +**NPM** + +```bash +npm install @giraugh/tools +``` + +## Usage + +```ts +import { pluralize } from "@giraugh/tools"; + +pluralize("cake", 2) === "cakes"; +``` + +## Documentation + +**[πŸ“„ Visit documentation](/docs/modules.md)** + +Docs are auto generated based on TSDoc comments. See the full API docs above for a list of tools and constants you can use. + +## Development + +If you find an issue or want to request a feature, please [create an issue](https://github.com/giraugh/tools/issues/new/choose). + +Refer to the [Contributing Guide](./CONTRIBUTING.md) for details on local development and contributing to this project. + +## License + +`@giraugh/tools` is licensed under MIT diff --git a/docs/arrays/arrays.md b/docs/arrays/arrays.md new file mode 100644 index 0000000..a95e3f8 --- /dev/null +++ b/docs/arrays/arrays.md @@ -0,0 +1,20 @@ +[@giraugh/tools](../modules.md) / arrays + +# arrays + +## Index + +### Type Aliases + +- [Zipped](types/type-alias.Zipped.md) +- [ZippedLongest](types/type-alias.ZippedLongest.md) + +### Functions + +- [chunkArray](functions/function.chunkArray.md) +- [dedupArrayBy](functions/function.dedupArrayBy.md) +- [groupArrayBy](functions/function.groupArrayBy.md) +- [partitionArray](functions/function.partitionArray.md) +- [range](functions/function.range.md) +- [zipArrays](functions/function.zipArrays.md) +- [zipArraysLongest](functions/function.zipArraysLongest.md) diff --git a/docs/arrays/functions/function.chunkArray.md b/docs/arrays/functions/function.chunkArray.md new file mode 100644 index 0000000..8a0492f --- /dev/null +++ b/docs/arrays/functions/function.chunkArray.md @@ -0,0 +1,50 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / chunkArray + +# Function: chunkArray() + +Chunk array into an array of chunks of given size + +## Note + +this can return partial chunks + +## Example + +```ts +chunkArray([1, 2, 3, 4, 5, 6], 3) === + [ + [1, 2, 3], + [4, 5, 6], + ]; +``` + +## Example + +```ts +chunkArray([1, 2, 3, 4, 5, 6, 7], 3) === [[1, 2, 3], [4, 5, 6], [7]]; +``` + +> **chunkArray**\(array: `T`[], chunkSize: `number`): `T`[][] + +## Type parameters + +| Parameter | +| :-------- | +| T | + +## Parameters + +| Parameter | Type | Description | +| :-------- | :------- | :---------------------------- | +| array | `T`[] | array to chunk | +| chunkSize | `number` | number of items in each chunk | + +## Returns + +`T`[][] + +array of chunks + +## Defined in + +[arrays/chunkArray.ts:11](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/chunkArray.ts#L11) diff --git a/docs/arrays/functions/function.dedupArrayBy.md b/docs/arrays/functions/function.dedupArrayBy.md new file mode 100644 index 0000000..384b2c8 --- /dev/null +++ b/docs/arrays/functions/function.dedupArrayBy.md @@ -0,0 +1,44 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / dedupArrayBy + +# Function: dedupArrayBy() + +Deduplicate the values in an array using a specified key function. +Preserves order. + +## Example + +```ts +const animals = [ + { id: 1, animal: "whale" }, + { id: 1, animal: "gorilla" }, + { id: 2, animal: "ant" }, +]; +dedupArrayBy(animals, (animal) => animal.id) === + [ + { id: 1, animal: "whale" }, + { id: 2, animal: "ant" }, + ]; +``` + +> **dedupArrayBy**\(array: `T`[], keyFn: `Function`): `T`[] + +## Type parameters + +| Parameter | +| :-------------------- | +| T _extends_ `unknown` | + +## Parameters + +| Parameter | Type | Description | +| :-------- | :-------------------------- | :--------------------------------------- | +| array | `T`[] | the array to deduplicate | +| keyFn | (`t`: `T`) => `PropertyKey` | a function to generate a key to dedup by | + +## Returns + +`T`[] + +## Defined in + +[arrays/dedupArrayBy.ts:18](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/dedupArrayBy.ts#L18) diff --git a/docs/arrays/functions/function.groupArrayBy.md b/docs/arrays/functions/function.groupArrayBy.md new file mode 100644 index 0000000..56b67bf --- /dev/null +++ b/docs/arrays/functions/function.groupArrayBy.md @@ -0,0 +1,61 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / groupArrayBy + +# Function: groupArrayBy() + +Group an array using a grouping function + +## Example + +```ts +groupArrayBy([1, 2, 3, 4], (x) => x % 2) === + [ + [1, 3], + [2, 4], + ]; +``` + +## Example + +```ts +const peopleByAge = groupArrayBy( + [ + { name: "John", age: 20 }, + { name: "Claire", age: 20 }, + { name: "Ben", age: 23 }, + ], + (person) => person.age +); +peopleByAge === + [ + [ + { name: "John", age: 20 }, + { name: "Claire", age: 20 }, + ], + [{ name: "Ben", age: 23 }], + ]; +``` + +> **groupArrayBy**\(array: `T`[], groupFn: `Function`): `T`[][] + +## Type parameters + +| Parameter | +| :-------- | +| T | + +## Parameters + +| Parameter | Type | Description | +| :-------- | :-------------------------------- | :-------------------------------------------------------------------------------------------------------------- | +| array | `T`[] | the array to create groups from | +| groupFn | (`element`: `T`) => `PropertyKey` | the keys to group by. Elements which return the same key when passed to this function will be in the same group | + +## Returns + +`T`[][] + +groups built from the array + +## Defined in + +[arrays/groupArrayBy.ts:22](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/groupArrayBy.ts#L22) diff --git a/docs/arrays/functions/function.partitionArray.md b/docs/arrays/functions/function.partitionArray.md new file mode 100644 index 0000000..37f0058 --- /dev/null +++ b/docs/arrays/functions/function.partitionArray.md @@ -0,0 +1,38 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / partitionArray + +# Function: partitionArray() + +Split an array into two subarrays using a predicate function + +## Example + +```ts +const [even, odd] = partitionArray([1, 2, 3, 4], (x) => x % 2 === 0); +even === [2, 4]; +odd === [1, 3]; +``` + +> **partitionArray**\(array: `T`[], predicateFn: `Function`): [`T`[], `T`[]] + +## Type parameters + +| Parameter | +| :-------- | +| T | + +## Parameters + +| Parameter | Type | Description | +| :---------- | :---------------------- | :----------------------------------- | +| array | `T`[] | the array to partition | +| predicateFn | (`t`: `T`) => `boolean` | the boolean predicate to split along | + +## Returns + +[`T`[], `T`[]] + +the two partitions + +## Defined in + +[arrays/partitionArray.ts:12](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/partitionArray.ts#L12) diff --git a/docs/arrays/functions/function.range.md b/docs/arrays/functions/function.range.md new file mode 100644 index 0000000..88aae8a --- /dev/null +++ b/docs/arrays/functions/function.range.md @@ -0,0 +1,46 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / range + +# Function: range() + +Create an array of integers in the specified range + +## Example + +```ts +range(1, 3) === [1, 2, 3]; +``` + +## Example + +```ts +range(3, 8) === [3, 4, 5, 6, 7, 8]; +``` + +## Example + +```ts +range(5, 1, -1) === [5, 4, 3, 2, 1]; +``` + +> **range**( +> start: `number`, +> end: `number`, +> interval: `number` = `1`): `number`[] + +## Parameters + +| Parameter | Type | Default value | Description | +| :-------- | :------- | :------------ | :--------------------------------------------------- | +| start | `number` | undefined | start of range (inclusive) | +| end | `number` | undefined | end of range (inclusive) | +| interval | `number` | 1 | the jump between successive elements (defaults to 1) | + +## Returns + +`number`[] + +the range as an array of numbers + +## Defined in + +[arrays/range.ts:11](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/range.ts#L11) diff --git a/docs/arrays/functions/function.zipArrays.md b/docs/arrays/functions/function.zipArrays.md new file mode 100644 index 0000000..ebe1081 --- /dev/null +++ b/docs/arrays/functions/function.zipArrays.md @@ -0,0 +1,50 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / zipArrays + +# Function: zipArrays() + +Zip a collection of arrays to create an array of tuples from matching indices. + +## Note + +the zipped array has the length of the shortest input array + +## Example + +```ts +zipArrays([1, 2, 3], ["a", "b", "c"]) === + [ + [1, "a"], + [2, "b"], + [3, "c"], + ]; +``` + +## Example + +```ts +zipArrays([1], ["a", "b", "c"]) === [[1, "a"]]; +``` + +> **zipArrays**\(...arrays: `TArrs`): [`Zipped`](../types/type-alias.Zipped.md)\<`TArrs`\> + +## Type parameters + +| Parameter | +| :---------------------------- | +| TArrs _extends_ `unknown`[][] | + +## Parameters + +| Parameter | Type | +| :-------- | :------ | +| ...arrays | `TArrs` | + +## Returns + +[`Zipped`](../types/type-alias.Zipped.md)\<`TArrs`\> + +the zipped array + +## Defined in + +[arrays/zipArrays.ts:12](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/zipArrays.ts#L12) diff --git a/docs/arrays/functions/function.zipArraysLongest.md b/docs/arrays/functions/function.zipArraysLongest.md new file mode 100644 index 0000000..0d7de9b --- /dev/null +++ b/docs/arrays/functions/function.zipArraysLongest.md @@ -0,0 +1,58 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / zipArraysLongest + +# Function: zipArraysLongest() + +Zip a collection of arrays to create an array of tuples from matching indices. +Use the length of the longest array for the output, filling the rest with the provided value. + +## Note + +the zipped array has the length of the longest input array + +## Example + +```ts +zipArraysLongest(null, [1, 2, 3], ["a", "b", "c"]) === + [ + [1, "a"], + [2, "b"], + [3, "c"], + ]; +``` + +## Example + +```ts +zipArraysLongest(null, [1], ["a", "b", "c"]) === + [ + [1, "a"], + [null, "b"], + [null, "c"], + ]; +``` + +> **zipArraysLongest**\(fill: `TFill`, ...arrays: `TArrs`): [`ZippedLongest`](../types/type-alias.ZippedLongest.md)\<`TFill`, `TArrs`\> + +## Type parameters + +| Parameter | +| :---------------------------- | +| TArrs _extends_ `unknown`[][] | +| TFill | + +## Parameters + +| Parameter | Type | Description | +| :-------- | :------ | :------------------------------------ | +| fill | `TFill` | the value to fill empty indices with. | +| ...arrays | `TArrs` | - | + +## Returns + +[`ZippedLongest`](../types/type-alias.ZippedLongest.md)\<`TFill`, `TArrs`\> + +the zipped array + +## Defined in + +[arrays/zipArraysLongest.ts:14](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/zipArraysLongest.ts#L14) diff --git a/docs/arrays/types/type-alias.Zipped.md b/docs/arrays/types/type-alias.Zipped.md new file mode 100644 index 0000000..b80a359 --- /dev/null +++ b/docs/arrays/types/type-alias.Zipped.md @@ -0,0 +1,15 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / Zipped + +# Type alias: Zipped\ + +> **Zipped**: \<`TArrs`\> \{ [TArr in keyof TArrs]: TArrs[TArr] extends (infer V)[] ? V : never }[] + +## Type parameters + +| Parameter | +| :---------------------------- | +| TArrs _extends_ `unknown`[][] | + +## Defined in + +[arrays/zipArrays.ts:1](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/zipArrays.ts#L1) diff --git a/docs/arrays/types/type-alias.ZippedLongest.md b/docs/arrays/types/type-alias.ZippedLongest.md new file mode 100644 index 0000000..d86a8ed --- /dev/null +++ b/docs/arrays/types/type-alias.ZippedLongest.md @@ -0,0 +1,16 @@ +[@giraugh/tools](../../modules.md) / [arrays](../arrays.md) / ZippedLongest + +# Type alias: ZippedLongest\ + +> **ZippedLongest**: \<`TFill`, `TArrs`\> \{ [TArr in keyof TArrs]: TArrs[TArr] extends (infer V)[] ? V \| TFill : never }[] + +## Type parameters + +| Parameter | +| :---------------------------- | +| TFill | +| TArrs _extends_ `unknown`[][] | + +## Defined in + +[arrays/zipArraysLongest.ts:1](https://github.com/giraugh/tools/blob/a6c3d4a/lib/arrays/zipArraysLongest.ts#L1) diff --git a/docs/errors/errors.md b/docs/errors/errors.md new file mode 100644 index 0000000..40edd63 --- /dev/null +++ b/docs/errors/errors.md @@ -0,0 +1,9 @@ +[@giraugh/tools](../modules.md) / errors + +# errors + +## Index + +### Functions + +- [expectOrThrow](functions/function.expectOrThrow.md) diff --git a/docs/errors/functions/function.expectOrThrow.md b/docs/errors/functions/function.expectOrThrow.md new file mode 100644 index 0000000..e0c8f31 --- /dev/null +++ b/docs/errors/functions/function.expectOrThrow.md @@ -0,0 +1,49 @@ +[@giraugh/tools](../../modules.md) / [errors](../errors.md) / expectOrThrow + +# Function: expectOrThrow() + +Assert that a value is available. +Throw an error with the specified message if the provided value is null or undefined + +## Example + +```ts +expectOrThrow(1) === 1; +``` + +## Example + +```ts +expectOrThrow(null); // throws error +``` + +## Example + +```ts +expectOrThrow(null, ":("); // throws error w/ message ':(' +``` + +> **expectOrThrow**\(t: `undefined` \| `null` \| `T`, message: `string` = `'Expected argument to be defined'`): `T` + +## Type parameters + +| Parameter | +| :-------- | +| T | + +## Parameters + +| Parameter | Type | Default value | +| :-------- | :--------------------------- | :-------------------------------- | +| t | `undefined` \| `null` \| `T` | undefined | +| message | `string` | 'Expected argument to be defined' | + +## Returns + +`T` + +the value + +## Defined in + +[errors/expectOrThrow.ts:12](https://github.com/giraugh/tools/blob/a6c3d4a/lib/errors/expectOrThrow.ts#L12) diff --git a/docs/interpolation/functions/function.lerp.md b/docs/interpolation/functions/function.lerp.md new file mode 100644 index 0000000..7d71b9c --- /dev/null +++ b/docs/interpolation/functions/function.lerp.md @@ -0,0 +1,46 @@ +[@giraugh/tools](../../modules.md) / [interpolation](../interpolation.md) / lerp + +# Function: lerp() + +Get a value linearly interpolated between two endpoints. + +## Example + +```ts +lerp(0, 4, 0) === 0; +``` + +## Example + +```ts +lerp(0, 4, 0.5) === 2; +``` + +## Example + +```ts +lerp(0, 4, 1) === 4; +``` + +> **lerp**( +> a: `number`, +> b: `number`, +> t: `number`): `number` + +## Parameters + +| Parameter | Type | Description | +| :-------- | :------- | :-------------------------------------------------------- | +| a | `number` | the end point for the interpolation | +| b | `number` | the start point for the interpolation | +| t | `number` | the amount to interpolate. A value in the range `0<=t<=1` | + +## Returns + +`number` + +the value that is `t%` from `a` to `b` + +## Defined in + +[interpolation/lerp.ts:12](https://github.com/giraugh/tools/blob/a6c3d4a/lib/interpolation/lerp.ts#L12) diff --git a/docs/interpolation/interpolation.md b/docs/interpolation/interpolation.md new file mode 100644 index 0000000..a2b5fc0 --- /dev/null +++ b/docs/interpolation/interpolation.md @@ -0,0 +1,9 @@ +[@giraugh/tools](../modules.md) / interpolation + +# interpolation + +## Index + +### Functions + +- [lerp](functions/function.lerp.md) diff --git a/docs/math/functions/function.product.md b/docs/math/functions/function.product.md new file mode 100644 index 0000000..f170926 --- /dev/null +++ b/docs/math/functions/function.product.md @@ -0,0 +1,22 @@ +[@giraugh/tools](../../modules.md) / [math](../math.md) / product + +# Function: product() + +Multiplies the two operands + +> **product**(a: `number`, b: `number`): `number` + +## Parameters + +| Parameter | Type | +| :-------- | :------- | +| a | `number` | +| b | `number` | + +## Returns + +`number` + +## Defined in + +[math/product.ts:2](https://github.com/giraugh/tools/blob/a6c3d4a/lib/math/product.ts#L2) diff --git a/docs/math/functions/function.sum.md b/docs/math/functions/function.sum.md new file mode 100644 index 0000000..9b7911c --- /dev/null +++ b/docs/math/functions/function.sum.md @@ -0,0 +1,22 @@ +[@giraugh/tools](../../modules.md) / [math](../math.md) / sum + +# Function: sum() + +Adds the two operands + +> **sum**(a: `number`, b: `number`): `number` + +## Parameters + +| Parameter | Type | +| :-------- | :------- | +| a | `number` | +| b | `number` | + +## Returns + +`number` + +## Defined in + +[math/sum.ts:2](https://github.com/giraugh/tools/blob/a6c3d4a/lib/math/sum.ts#L2) diff --git a/docs/math/math.md b/docs/math/math.md new file mode 100644 index 0000000..ab32ad9 --- /dev/null +++ b/docs/math/math.md @@ -0,0 +1,17 @@ +[@giraugh/tools](../modules.md) / math + +# math + +## Index + +### Variables + +- [EARTH_GRAVITY](variables/variable.EARTH_GRAVITY.md) +- [GOLDEN_RATIO](variables/variable.GOLDEN_RATIO.md) +- [JUPITER_GRAVITY](variables/variable.JUPITER_GRAVITY.md) +- [TAU](variables/variable.TAU.md) + +### Functions + +- [product](functions/function.product.md) +- [sum](functions/function.sum.md) diff --git a/docs/math/variables/variable.EARTH_GRAVITY.md b/docs/math/variables/variable.EARTH_GRAVITY.md new file mode 100644 index 0000000..ea2a0c0 --- /dev/null +++ b/docs/math/variables/variable.EARTH_GRAVITY.md @@ -0,0 +1,9 @@ +[@giraugh/tools](../../modules.md) / [math](../math.md) / EARTH_GRAVITY + +# Variable: EARTH_GRAVITY + +> `const` **EARTH_GRAVITY**: 9.81 = `9.81` + +## Defined in + +[math/constants.ts:3](https://github.com/giraugh/tools/blob/a6c3d4a/lib/math/constants.ts#L3) diff --git a/docs/math/variables/variable.GOLDEN_RATIO.md b/docs/math/variables/variable.GOLDEN_RATIO.md new file mode 100644 index 0000000..466bc91 --- /dev/null +++ b/docs/math/variables/variable.GOLDEN_RATIO.md @@ -0,0 +1,9 @@ +[@giraugh/tools](../../modules.md) / [math](../math.md) / GOLDEN_RATIO + +# Variable: GOLDEN_RATIO + +> `const` **GOLDEN_RATIO**: 1.618033988749 = `1.618033988749` + +## Defined in + +[math/constants.ts:2](https://github.com/giraugh/tools/blob/a6c3d4a/lib/math/constants.ts#L2) diff --git a/docs/math/variables/variable.JUPITER_GRAVITY.md b/docs/math/variables/variable.JUPITER_GRAVITY.md new file mode 100644 index 0000000..bf72c33 --- /dev/null +++ b/docs/math/variables/variable.JUPITER_GRAVITY.md @@ -0,0 +1,9 @@ +[@giraugh/tools](../../modules.md) / [math](../math.md) / JUPITER_GRAVITY + +# Variable: JUPITER_GRAVITY + +> `const` **JUPITER_GRAVITY**: 24.79 = `24.79` + +## Defined in + +[math/constants.ts:4](https://github.com/giraugh/tools/blob/a6c3d4a/lib/math/constants.ts#L4) diff --git a/docs/math/variables/variable.TAU.md b/docs/math/variables/variable.TAU.md new file mode 100644 index 0000000..fe5fd10 --- /dev/null +++ b/docs/math/variables/variable.TAU.md @@ -0,0 +1,9 @@ +[@giraugh/tools](../../modules.md) / [math](../math.md) / TAU + +# Variable: TAU + +> `const` **TAU**: `number` + +## Defined in + +[math/constants.ts:1](https://github.com/giraugh/tools/blob/a6c3d4a/lib/math/constants.ts#L1) diff --git a/docs/modules.md b/docs/modules.md new file mode 100644 index 0000000..cae201c --- /dev/null +++ b/docs/modules.md @@ -0,0 +1,15 @@ +[Readme](README.md) + +# @giraugh/tools + +## Index + +### Modules + +- [arrays](arrays/arrays.md) +- [errors](errors/errors.md) +- [interpolation](interpolation/interpolation.md) +- [math](math/math.md) +- [objects](objects/objects.md) +- [promises](promises/promises.md) +- [strings](strings/strings.md) diff --git a/docs/objects/functions/function.getKey.md b/docs/objects/functions/function.getKey.md new file mode 100644 index 0000000..061570e --- /dev/null +++ b/docs/objects/functions/function.getKey.md @@ -0,0 +1,47 @@ +[@giraugh/tools](../../modules.md) / [objects](../objects.md) / getKey + +# Function: getKey() + +Higher order function to get a key from an object + +## Example + +```ts +getKey("name")({ name: "John" }) === "John"; +``` + +> **getKey**\(key: _keyof_ `TObj`): `Function` + +## Type parameters + +| Parameter | +| :-------- | +| TObj | + +## Parameters + +| Parameter | Type | Description | +| :-------- | :------------- | :------------------ | +| key | _keyof_ `TObj` | the key to retrieve | + +## Returns + +`Function` + +function that retrieves the key from an object + +> (obj: `TObj`): `TObj`[*keyof* `TObj`] + +### Parameters + +| Parameter | Type | +| :-------- | :----- | +| obj | `TObj` | + +### Returns + +`TObj`[*keyof* `TObj`] + +## Defined in + +[objects/getKey.ts:8](https://github.com/giraugh/tools/blob/a6c3d4a/lib/objects/getKey.ts#L8) diff --git a/docs/objects/functions/function.mergeObjectValuesBy.md b/docs/objects/functions/function.mergeObjectValuesBy.md new file mode 100644 index 0000000..f45e369 --- /dev/null +++ b/docs/objects/functions/function.mergeObjectValuesBy.md @@ -0,0 +1,39 @@ +[@giraugh/tools](../../modules.md) / [objects](../objects.md) / mergeObjectValuesBy + +# Function: mergeObjectValuesBy() + +Merge the values of an array of objects using the specified merging function + +## Example + +```ts +const obj = mergeObjectValuesBy( + [{ test: "some" }, { test: null }], + (a, b) => a || b +); +obj.test === "some"; +``` + +> **mergeObjectValuesBy**\(objects: `TObj`[], mergeFn: `Function`): `TObj` + +## Type parameters + +| Parameter | +| :-------------------------------------------- | +| TKeys _extends_ `PropertyKey` | +| TObj _extends_ `Record`\<`TKeys`, `unknown`\> | + +## Parameters + +| Parameter | Type | Description | +| :-------- | :-------------------------------------------------------------- | :--------------------------------------------- | +| objects | `TObj`[] | the array of objects to merge | +| mergeFn | (`a`: `TObj`[`TKeys`], `b`: `TObj`[`TKeys`]) => `TObj`[`TKeys`] | a function which defines the merging operation | + +## Returns + +`TObj` + +## Defined in + +[objects/mergeObjectValuesBy.ts:10](https://github.com/giraugh/tools/blob/a6c3d4a/lib/objects/mergeObjectValuesBy.ts#L10) diff --git a/docs/objects/objects.md b/docs/objects/objects.md new file mode 100644 index 0000000..7bbbb9e --- /dev/null +++ b/docs/objects/objects.md @@ -0,0 +1,10 @@ +[@giraugh/tools](../modules.md) / objects + +# objects + +## Index + +### Functions + +- [getKey](functions/function.getKey.md) +- [mergeObjectValuesBy](functions/function.mergeObjectValuesBy.md) diff --git a/docs/promises/functions/function.filterAsync.md b/docs/promises/functions/function.filterAsync.md new file mode 100644 index 0000000..94ed363 --- /dev/null +++ b/docs/promises/functions/function.filterAsync.md @@ -0,0 +1,36 @@ +[@giraugh/tools](../../modules.md) / [promises](../promises.md) / filterAsync + +# Function: filterAsync() + +Filter an array in parallel using an async predicate function. + +## Example + +```ts +(await filterAsync([1, 2, 3], (x) => Promise.resolve(x % 2 === 0))) === [2]; +``` + +> **filterAsync**\(array: `T`[], asyncPredicateFn: `Function`): `Promise`\<`T`[]\> + +## Type parameters + +| Parameter | +| :-------- | +| T | + +## Parameters + +| Parameter | Type | Description | +| :--------------- | :-------------------------------------------------------------------- | :------------------------------------------ | +| array | `T`[] | the array to filter | +| asyncPredicateFn | (`value`: `T`, `i`: `number`, `arr`: `T`[]) => `Promise`\<`boolean`\> | the predicate function as an async function | + +## Returns + +`Promise`\<`T`[]\> + +a promise of the filtered array. it will resolve when all of the async predicates resolve + +## Defined in + +[promises/filterAsync.ts:9](https://github.com/giraugh/tools/blob/a6c3d4a/lib/promises/filterAsync.ts#L9) diff --git a/docs/promises/functions/function.mapAsync.md b/docs/promises/functions/function.mapAsync.md new file mode 100644 index 0000000..9fa779a --- /dev/null +++ b/docs/promises/functions/function.mapAsync.md @@ -0,0 +1,37 @@ +[@giraugh/tools](../../modules.md) / [promises](../promises.md) / mapAsync + +# Function: mapAsync() + +Map an array in parallel using an async mapping function. + +## Example + +```ts +(await mapAsync([1, 2, 3], (x) => Promise.resolve(x + 1))) === [2, 3, 4]; +``` + +> **mapAsync**\(array: `TFrom`[], asyncMapFn: `Function`): `Promise`\<`TTo`[]\> + +## Type parameters + +| Parameter | +| :-------- | +| TFrom | +| TTo | + +## Parameters + +| Parameter | Type | Description | +| :--------- | :------------------------------------------------------------------------ | :---------------------------------------- | +| array | `TFrom`[] | the array to filter | +| asyncMapFn | (`value`: `TFrom`, `i`: `number`, `arr`: `TFrom`[]) => `Promise`\<`TTo`\> | the mapping function as an async function | + +## Returns + +`Promise`\<`TTo`[]\> + +a promise of the mapped array. it will resolve when all of the elements resolve + +## Defined in + +[promises/mapAsync.ts:9](https://github.com/giraugh/tools/blob/a6c3d4a/lib/promises/mapAsync.ts#L9) diff --git a/docs/promises/functions/function.resolveObject.md b/docs/promises/functions/function.resolveObject.md new file mode 100644 index 0000000..8067651 --- /dev/null +++ b/docs/promises/functions/function.resolveObject.md @@ -0,0 +1,47 @@ +[@giraugh/tools](../../modules.md) / [promises](../promises.md) / resolveObject + +# Function: resolveObject() + +Resolve all of the fields of an object in parallel + +## Example + +```ts +(await resolveObject({ + a: Promise.resolve("a"), + b: Promise.resolve("b"), +})) === { a: "a", b: "b" }; +``` + +## Example + +```ts +await resolveObject({ + a: Promise.resolve("a"), + b: Promise.reject("b"), +}); // throws error +``` + +> **resolveObject**\(object: `T`): `Promise`\<`Resolved`\<`T`\>\> + +## Type parameters + +| Parameter | +| :-------------------------- | +| T _extends_ `PromiseRecord` | + +## Parameters + +| Parameter | Type | Description | +| :-------- | :--- | :--------------------------------------- | +| object | `T` | An object where every field is a promise | + +## Returns + +`Promise`\<`Resolved`\<`T`\>\> + +The same object with every field resolved + +## Defined in + +[promises/resolveObject.ts:19](https://github.com/giraugh/tools/blob/a6c3d4a/lib/promises/resolveObject.ts#L19) diff --git a/docs/promises/promises.md b/docs/promises/promises.md new file mode 100644 index 0000000..dab51df --- /dev/null +++ b/docs/promises/promises.md @@ -0,0 +1,11 @@ +[@giraugh/tools](../modules.md) / promises + +# promises + +## Index + +### Functions + +- [filterAsync](functions/function.filterAsync.md) +- [mapAsync](functions/function.mapAsync.md) +- [resolveObject](functions/function.resolveObject.md) diff --git a/docs/strings/functions/function.capitalize.md b/docs/strings/functions/function.capitalize.md new file mode 100644 index 0000000..f70fc26 --- /dev/null +++ b/docs/strings/functions/function.capitalize.md @@ -0,0 +1,35 @@ +[@giraugh/tools](../../modules.md) / [strings](../strings.md) / capitalize + +# Function: capitalize() + +Capitalise a string + +## Example + +```ts +capitalize("hello world") === "Hello world"; +``` + +## Example + +```ts +capitalize("Hello world") === "Hello world"; +``` + +> **capitalize**(string: `string`): `string` + +## Parameters + +| Parameter | Type | Description | +| :-------- | :------- | :------------------- | +| string | `string` | string to capitalise | + +## Returns + +`string` + +the string with the first character in uppercase + +## Defined in + +[strings/capitalize.ts:8](https://github.com/giraugh/tools/blob/a6c3d4a/lib/strings/capitalize.ts#L8) diff --git a/docs/strings/functions/function.editDistance.md b/docs/strings/functions/function.editDistance.md new file mode 100644 index 0000000..2de53a6 --- /dev/null +++ b/docs/strings/functions/function.editDistance.md @@ -0,0 +1,31 @@ +[@giraugh/tools](../../modules.md) / [strings](../strings.md) / editDistance + +# Function: editDistance() + +Compute the levenshtein edit distance between two strings. +Equivalent to the the number of edits necessary to get from source to target. + +## Example + +```ts +editDistance("snail", "mail") === 2; +``` + +> **editDistance**(source: `string`, target: `string`): `number` + +## Parameters + +| Parameter | Type | Description | +| :-------- | :------- | :---------------------- | +| source | `string` | string to use as source | +| target | `string` | target string | + +## Returns + +`number` + +the number of changes to edit source into target + +## Defined in + +[strings/editDistance.ts:10](https://github.com/giraugh/tools/blob/a6c3d4a/lib/strings/editDistance.ts#L10) diff --git a/docs/strings/functions/function.pluralize.md b/docs/strings/functions/function.pluralize.md new file mode 100644 index 0000000..01a2ef7 --- /dev/null +++ b/docs/strings/functions/function.pluralize.md @@ -0,0 +1,50 @@ +[@giraugh/tools](../../modules.md) / [strings](../strings.md) / pluralize + +# Function: pluralize() + +Take a string and pluralize it depending on a count + +## Example + +```ts +pluralize("cake", 1) === "cake"; +``` + +## Example + +```ts +pluralize("cake", 2) === "cakes"; +``` + +## Example + +```ts +pluralize("cake", 0) === "cakes"; +``` + +## Example + +```ts +pluralize("child", 2, "children") === "children"; +``` + +> **pluralize**( +> str: `string`, +> count: `number`, +> plural: `string` = `...`): `string` + +## Parameters + +| Parameter | Type | Description | +| :-------- | :------- | :-------------------------------------------------------------------------------------- | +| str | `string` | The singular form of the word | +| count | `number` | The amount of things you have | +| plural | `string` | Optionally, a plural form of the word. This is `str` with an `s` on the end by default. | + +## Returns + +`string` + +## Defined in + +[strings/pluralize.ts:12](https://github.com/giraugh/tools/blob/a6c3d4a/lib/strings/pluralize.ts#L12) diff --git a/docs/strings/functions/function.truncateWithEllipsis.md b/docs/strings/functions/function.truncateWithEllipsis.md new file mode 100644 index 0000000..911638d --- /dev/null +++ b/docs/strings/functions/function.truncateWithEllipsis.md @@ -0,0 +1,50 @@ +[@giraugh/tools](../../modules.md) / [strings](../strings.md) / truncateWithEllipsis + +# Function: truncateWithEllipsis() + +Truncate a string if its too long, adding an ellipsis if truncation occurs + +## Note + +the ellipsis should be shorter than the maxlength for proper results + +## Example + +```ts +truncateWithEllipsis("hello there", 3) === "he…"; +``` + +## Example + +```ts +truncateWithEllipsis("hello there", 30) === "hello there"; +``` + +## Example + +```ts +truncateWithEllipsis("hello there", 7, "...") === "hell..."; +``` + +> **truncateWithEllipsis**( +> string: `string`, +> maxLength: `number` = `50`, +> ellipsis: `string` = `'…'`): `string` + +## Parameters + +| Parameter | Type | Default value | Description | +| :-------- | :------- | :------------ | :------------------------------------------------------------------- | +| string | `string` | undefined | the string to truncate | +| maxLength | `number` | 50 | the maximum length of the returned string | +| ellipsis | `string` | '…' | the ellipsis to add to the string. Defaults to an ellipsis character | + +## Returns + +`string` + +the truncated string with length <= `maxLength` + +## Defined in + +[strings/truncateWithEllipsis.ts:12](https://github.com/giraugh/tools/blob/a6c3d4a/lib/strings/truncateWithEllipsis.ts#L12) diff --git a/docs/strings/strings.md b/docs/strings/strings.md new file mode 100644 index 0000000..1df4a7f --- /dev/null +++ b/docs/strings/strings.md @@ -0,0 +1,12 @@ +[@giraugh/tools](../modules.md) / strings + +# strings + +## Index + +### Functions + +- [capitalize](functions/function.capitalize.md) +- [editDistance](functions/function.editDistance.md) +- [pluralize](functions/function.pluralize.md) +- [truncateWithEllipsis](functions/function.truncateWithEllipsis.md) diff --git a/package.json b/package.json index 7f0bd72..04e6d9c 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,13 @@ "scripts": { "build": "tsc && vite build", "test": "vitest", + "docs": "typedoc --plugin typedoc-plugin-markdown --out docs lib/**/index.ts", "ci:release": "yarn build && yarn changeset publish" }, "devDependencies": { "@changesets/cli": "^2.26.1", + "typedoc": "^0.24.4", + "typedoc-plugin-markdown": "4.0.0-next.7", "typescript": "^4.6.4", "vite": "^4.2.1", "vite-plugin-dts": "^1.6.5", diff --git a/yarn.lock b/yarn.lock index f5e477c..f4ae1cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -608,6 +608,11 @@ ansi-regex@^5.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== +ansi-sequence-parser@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz#4d790f31236ac20366b23b3916b789e1bde39aed" + integrity sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ== + ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -1692,6 +1697,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lunr@^2.3.9: + version "2.3.9" + resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" + integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== + magic-string@^0.30.0: version "0.30.0" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.0.tgz#fd58a4748c5c4547338a424e90fa5dd17f4de529" @@ -1709,6 +1719,11 @@ map-obj@^4.0.0: resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== +marked@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" + integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== + md5-hex@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-3.0.1.tgz#be3741b510591434b2784d79e556eefc2c9a8e5c" @@ -1758,6 +1773,13 @@ minimatch@^5.1.0: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.0.tgz#bfc8e88a1c40ffd40c172ddac3decb8451503b56" + integrity sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w== + dependencies: + brace-expansion "^2.0.1" + minimist-options@^4.0.2: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -2163,6 +2185,16 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== +shiki@^0.14.1: + version "0.14.1" + resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.14.1.tgz#9fbe082d0a8aa2ad63df4fbf2ee11ec924aa7ee1" + integrity sha512-+Jz4nBkCBe0mEDqo1eKRcCdjRtrCjozmcbTUjbPTX7OOJfEbTZzlUWlZtGe3Gb5oV1/jnojhG//YZc3rs9zSEw== + dependencies: + ansi-sequence-parser "^1.1.0" + jsonc-parser "^3.2.0" + vscode-oniguruma "^1.7.0" + vscode-textmate "^8.0.0" + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -2450,6 +2482,21 @@ typed-array-length@^1.0.4: for-each "^0.3.3" is-typed-array "^1.1.9" +typedoc-plugin-markdown@4.0.0-next.7: + version "4.0.0-next.7" + resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.0.0-next.7.tgz#37105cc2f5ca4690035309e5837762e1d473f944" + integrity sha512-fB3T1nWBo40DKwCXGQ4149RWmL7oRNPSuU2EsMycahEgc1hQ4AjIVPdPk6pcoZePMYO1wqBNdtE+WDmq9fZGpw== + +typedoc@^0.24.4: + version "0.24.4" + resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.24.4.tgz#bae677982115f94b9c6bc5d2bfa133350de7fedd" + integrity sha512-vQuliyGhJEGeKzzCFHbkS3m0gHoIL6cfr0fHf6eX658iGELtq2J9mWe0b+X5McEYgFoMuHFt5Py3Zug6Sxjn/Q== + dependencies: + lunr "^2.3.9" + marked "^4.3.0" + minimatch "^9.0.0" + shiki "^0.14.1" + typescript@^4.6.4: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" @@ -2575,6 +2622,16 @@ vitest@^0.30.0: vite-node "0.30.0" why-is-node-running "^2.2.2" +vscode-oniguruma@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" + integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== + +vscode-textmate@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" + integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== + wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" From cfb4f3afc5a58caa32528696d6b5dc761a97bdab Mon Sep 17 00:00:00 2001 From: Ben Grant Date: Thu, 20 Apr 2023 00:27:18 +1000 Subject: [PATCH 3/4] Add docs workflow to generate docs on push --- .github/workflows/docs.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..90c21bc --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,28 @@ +name: Docs + +on: + push: + branches: ['main'] + paths: + - '**/package.json' + - 'lib/**' + - '.github/workflows/docs.yml' + +jobs: + docs: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + - run: yarn install --immutable + - run: yarn docs + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'ci: generate docs' From c01c3bb90a1e3d267e9275645d8f250be4647017 Mon Sep 17 00:00:00 2001 From: Ben Grant Date: Thu, 20 Apr 2023 00:29:18 +1000 Subject: [PATCH 4/4] Add changeset for first major version --- .changeset/gold-dots-raise.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/gold-dots-raise.md diff --git a/.changeset/gold-dots-raise.md b/.changeset/gold-dots-raise.md new file mode 100644 index 0000000..f0dbeed --- /dev/null +++ b/.changeset/gold-dots-raise.md @@ -0,0 +1,5 @@ +--- +"@giraugh/tools": major +--- + +Added documentation and stable version bump