1
0
Fork 0

fix(docs): typedef and doc warnings

This commit is contained in:
Sean Sube 2022-10-08 14:52:35 -05:00
parent 30f68469e6
commit d3e52d9363
47 changed files with 436 additions and 95 deletions

View File

@ -4,31 +4,27 @@
"mainEntryPointFilePath": "<projectFolder>/out/src/index.d.ts",
"apiReport": {
"enabled": true,
"reportFolder": "<projectFolder>/out/",
"reportFolder": "<projectFolder>/docs/",
"reportTempFolder": "<projectFolder>/out/tmp/"
},
"docModel": {
"enabled": true,
"apiJsonFilePath": "<projectFolder>/out/api/<unscopedPackageName>.api.json"
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/out/index.d.ts",
"betaTrimmedFilePath": "<projectFolder>/out/index-beta.d.ts",
"publicTrimmedFilePath": "<projectFolder>/out/index-public.d.ts"
},
"tsdocMetadata": {
},
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"

View File

@ -4,6 +4,7 @@
## AllowedBufferEncoding type
<b>Signature:</b>
```typescript

View File

@ -22,9 +22,9 @@ export declare class ArrayMapper
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [rest](./js-utils.arraymapper.rest.md) | | string | |
| [skip](./js-utils.arraymapper.skip.md) | | number | |
| [take](./js-utils.arraymapper.take.md) | | Array&lt;string&gt; | |
| [rest](./js-utils.arraymapper.rest.md) | <code>readonly</code> | string | |
| [skip](./js-utils.arraymapper.skip.md) | <code>readonly</code> | number | |
| [take](./js-utils.arraymapper.take.md) | <code>readonly</code> | Array&lt;string&gt; | |
## Methods

View File

@ -4,6 +4,7 @@
## ArrayMapperOptions interface
<b>Signature:</b>
```typescript
@ -12,9 +13,9 @@ export interface ArrayMapperOptions
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [rest](./js-utils.arraymapperoptions.rest.md) | string | Key for any remaining, unmatched elements. |
| [skip](./js-utils.arraymapperoptions.skip.md) | number | Number of initial elements to skip. |
| [take](./js-utils.arraymapperoptions.take.md) | Array&lt;string&gt; | List of element keys. |
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [rest](./js-utils.arraymapperoptions.rest.md) | | string | Key for any remaining, unmatched elements. |
| [skip](./js-utils.arraymapperoptions.skip.md) | | number | Number of initial elements to skip. |
| [take](./js-utils.arraymapperoptions.take.md) | | Array&lt;string&gt; | List of element keys. |

View File

@ -4,7 +4,7 @@
## Checklist class
Check whether items are included or not (blacklist or whitelist, depending on `mode`<!-- -->).
Check whether items are included or not.
<b>Signature:</b>
@ -23,8 +23,8 @@ export declare class Checklist<T> implements ChecklistOptions<T>
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [data](./js-utils.checklist.data.md) | | Array&lt;T&gt; | TODO: switch to Set |
| [mode](./js-utils.checklist.mode.md) | | [ChecklistMode](./js-utils.checklistmode.md) | |
| [data](./js-utils.checklist.data.md) | <code>readonly</code> | Array&lt;T&gt; | TODO: switch to Set |
| [mode](./js-utils.checklist.mode.md) | <code>readonly</code> | [ChecklistMode](./js-utils.checklistmode.md) | |
## Methods

View File

@ -14,8 +14,8 @@ export interface ChecklistOptions<T>
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [data](./js-utils.checklistoptions.data.md) | Array&lt;T&gt; | |
| [mode](./js-utils.checklistoptions.mode.md) | [ChecklistMode](./js-utils.checklistmode.md) | |
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [data](./js-utils.checklistoptions.data.md) | | Array&lt;T&gt; | |
| [mode](./js-utils.checklistoptions.mode.md) | | [ChecklistMode](./js-utils.checklistmode.md) | |

View File

@ -4,6 +4,7 @@
## ChildOptions interface
<b>Signature:</b>
```typescript
@ -13,8 +14,8 @@ export interface ChildOptions extends ChildProcessOptions
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [args](./js-utils.childoptions.args.md) | Array&lt;string&gt; | |
| [command](./js-utils.childoptions.command.md) | string | |
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [args](./js-utils.childoptions.args.md) | | Array&lt;string&gt; | |
| [command](./js-utils.childoptions.command.md) | | string | |

View File

@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
| Parameter | Type | Description |
| --- | --- | --- |
| msg | string | |
| msg | string | <i>(Optional)</i> |
| nested | Array&lt;Error&gt; | |

View File

@ -4,6 +4,7 @@
## ChildResult interface
<b>Signature:</b>
```typescript
@ -12,9 +13,9 @@ export interface ChildResult
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [status](./js-utils.childresult.status.md) | number | |
| [stderr](./js-utils.childresult.stderr.md) | string | |
| [stdout](./js-utils.childresult.stdout.md) | string | |
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [status](./js-utils.childresult.status.md) | | number | |
| [stderr](./js-utils.childresult.stderr.md) | | string | |
| [stdout](./js-utils.childresult.stdout.md) | | string | |

View File

@ -4,6 +4,7 @@
## ChildSpawner type
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## Dict interface
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## ensureArray() function
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## filterZip() function
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## filterZip() function
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## filterZip() function
<b>Signature:</b>
```typescript

View File

@ -16,7 +16,7 @@ export declare function getTestLogger(verbose?: boolean): Logger;
| Parameter | Type | Description |
| --- | --- | --- |
| verbose | boolean | |
| verbose | boolean | <i>(Optional)</i> |
<b>Returns:</b>

View File

@ -4,6 +4,7 @@
## hasItems() function
<b>Signature:</b>
```typescript

View File

@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
| Parameter | Type | Description |
| --- | --- | --- |
| msg | string | |
| msg | string | <i>(Optional)</i> |
| nested | Array&lt;Error&gt; | |

View File

@ -1,19 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@apextoaster/js-utils](./js-utils.md) &gt; [isDebug](./js-utils.isdebug.md)
## isDebug() function
Test if DEBUG mode is set.
TODO: check variable value as well
<b>Signature:</b>
```typescript
export declare function isDebug(): boolean;
```
<b>Returns:</b>
boolean

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use `isNone` instead
>
Check if a value is nil.

View File

@ -17,8 +17,8 @@ export declare function leftPad(val: string, min?: number, fill?: string): strin
| Parameter | Type | Description |
| --- | --- | --- |
| val | string | |
| min | number | |
| fill | string | |
| min | number | <i>(Optional)</i> |
| fill | string | <i>(Optional)</i> |
<b>Returns:</b>

View File

@ -9,7 +9,7 @@
| Class | Description |
| --- | --- |
| [ArrayMapper](./js-utils.arraymapper.md) | Map an array of items into a map of arrays using the specified keys, able to <code>skip</code> initial items and gather remaining items into a <code>rest</code> key. |
| [Checklist](./js-utils.checklist.md) | Check whether items are included or not (blacklist or whitelist, depending on <code>mode</code>). |
| [Checklist](./js-utils.checklist.md) | Check whether items are included or not. |
| [ChildProcessError](./js-utils.childprocesserror.md) | Error indicating that a child process exited with an error status. |
| [InvalidArgumentError](./js-utils.invalidargumenterror.md) | Error indicating that an invalid argument was passed to a function call. |
| [MissingKeyError](./js-utils.missingkeyerror.md) | Error indicating that a required key did not exist in a map-like. |
@ -49,17 +49,16 @@
| [getMethods(value)](./js-utils.getmethods.md) | Get the methods from an instance and its prototypes. |
| [getOrDefault(map, key, defaultValue)](./js-utils.getordefault.md) | Get a map key or default value when the key does not exist or is nil. |
| [getTestLogger(verbose)](./js-utils.gettestlogger.md) | Get a test logger. Returns a null logger unless <code>verbose</code> is true or run under debug mode. |
| [hasItems(val)](./js-utils.hasitems.md) | Test if a value is an array with some items (<code>length &gt; 0</code>).<!-- -->This is not a general replacement for <code>.length &gt; 0</code>, since it is also a typeguard: <code>if (hasItems(val)) else { val }</code> will complain that <code>val</code> is <code>never</code> in the <code>else</code> branch, since it was proven not to be an array by this function, even if <code>val</code> is simply empty. |
| [hasItems(val)](./js-utils.hasitems.md) | <p>Test if a value is an array with some items (<code>length &gt; 0</code>).</p><p>This is not a general replacement for <code>.length &gt; 0</code>, since it is also a typeguard: <code>if (hasItems(val)) else { val }</code> will complain that <code>val</code> is <code>never</code> in the <code>else</code> branch, since it was proven not to be an array by this function, even if <code>val</code> is simply empty.</p> |
| [hasItems(val)](./js-utils.hasitems_1.md) | |
| [isArray(list)](./js-utils.isarray.md) | Wrapper for <code>Array.isArray</code> with better readonly type handling. |
| [isArray(list)](./js-utils.isarray_1.md) | Wrapper for <code>Array.isArray</code> with better readonly type handling. |
| [isDebug()](./js-utils.isdebug.md) | Test if DEBUG mode is set.<!-- -->TODO: check variable value as well |
| [isEmpty(val)](./js-utils.isempty.md) | Check if a <code>Maybe&lt;Array&lt;T&gt;&gt;</code> does in fact contain an array, and that array has items. |
| [isNil(val)](./js-utils.isnil.md) | Check if a value is nil. |
| [isNone(val)](./js-utils.isnone.md) | Typeguard to check if a <code>Maybe</code> is <code>None</code> (null or undefined). |
| [isSome(val)](./js-utils.issome.md) | Typeguard to check if a <code>Maybe</code> is <code>Some</code> value (not <code>None</code>). |
| [leftPad(val, min, fill)](./js-utils.leftpad.md) | Prefix <code>val</code> with <code>fill</code> until it is at least <code>min</code> characters. |
| [lengthOf(val)](./js-utils.lengthof.md) | Calculate the length of an array or value.<!-- -->Arrays return their length, single values return 1, and nil values return 0. This counts the number of elements that setOrPush would add. |
| [lengthOf(val)](./js-utils.lengthof.md) | <p>Calculate the length of an array or value.</p><p>Arrays return their length, single values return 1, and nil values return 0. This counts the number of elements that setOrPush would add.</p> |
| [makeDict(map)](./js-utils.makedict.md) | Turns a map or dict into a dict |
| [makeMap(val)](./js-utils.makemap.md) | Clone a map or map-like object into a new map. |
| [mergeArray(parts)](./js-utils.mergearray.md) | Merge arguments, which may or may not be arrays, into one return that is definitely an array. |
@ -79,8 +78,7 @@
| [removeNone(list)](./js-utils.removenone.md) | Remove any null or undefined items from the list. |
| [setOrPush(map, key, val)](./js-utils.setorpush.md) | Set a map key to a new array or push to the existing value. |
| [signal(signals)](./js-utils.signal.md) | Wait for an OS signal. |
| [spyLogger(spies)](./js-utils.spylogger.md) | Create a spy logger using the provided methods, which returns itself as a child. ensure all methods are present by extending null logger |
| [sum(a, b)](./js-utils.sum.md) | Add numbers. PredicateR2<!-- -->&lt;<!-- -->number, number<!-- -->&gt; |
| [sum(a, b)](./js-utils.sum.md) | Add numbers. |
| [timeout(ms, inner)](./js-utils.timeout.md) | Reject after a set amount of time if the original promise has not yet resolved. |
| [toArray(val)](./js-utils.toarray.md) | Copy an existing array-like or convert a single value to an array. |
| [toArray(val)](./js-utils.toarray_1.md) | Copy an existing readonly array-like or convert a single value to a readonly array. |

View File

@ -4,6 +4,7 @@
## mergeArray() function
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## mergeArrays() function
<b>Signature:</b>
```typescript

View File

@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
| Parameter | Type | Description |
| --- | --- | --- |
| msg | string | |
| msg | string | <i>(Optional)</i> |
| nested | Array&lt;Error&gt; | |

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use `mustDefault` instead
>
Return the first value that is not nil.

View File

@ -17,7 +17,7 @@ export declare function mustExist<T>(val: Maybe<T>, err?: string): T;
| Parameter | Type | Description |
| --- | --- | --- |
| val | [Maybe](./js-utils.maybe.md)<!-- -->&lt;T&gt; | |
| err | string | |
| err | string | <i>(Optional)</i> |
<b>Returns:</b>

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use `None` instead
>
Old name for None.

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> the conversion behavior here was not reliable, better to provide your own `T -> string` mapper
>
Normalize a map-like of values into a dict of lists of strings.

View File

@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
| Parameter | Type | Description |
| --- | --- | --- |
| msg | string | |
| msg | string | <i>(Optional)</i> |
| nested | Array&lt;Error&gt; | |

View File

@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
| Parameter | Type | Description |
| --- | --- | --- |
| msg | string | |
| msg | string | <i>(Optional)</i> |
| nested | Array&lt;Error&gt; | |

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use Maybe instead
>
Old name for Maybe.

View File

@ -4,6 +4,7 @@
## SIGNAL\_RELOAD variable
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## SIGNAL\_RESET variable
<b>Signature:</b>
```typescript

View File

@ -4,6 +4,7 @@
## SIGNAL\_STOP variable
<b>Signature:</b>
```typescript

View File

@ -1,26 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@apextoaster/js-utils](./js-utils.md) &gt; [spyLogger](./js-utils.spylogger.md)
## spyLogger() function
Create a spy logger using the provided methods, which returns itself as a child.
ensure all methods are present by extending null logger
<b>Signature:</b>
```typescript
export declare function spyLogger(spies: Partial<Logger>): Logger;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| spies | Partial&lt;Logger&gt; | |
<b>Returns:</b>
Logger

View File

@ -6,8 +6,6 @@
Add numbers.
PredicateR2<!-- -->&lt;<!-- -->number, number<!-- -->&gt;
<b>Signature:</b>
```typescript

View File

@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
| Parameter | Type | Description |
| --- | --- | --- |
| msg | string | |
| msg | string | <i>(Optional)</i> |
| nested | Array&lt;Error&gt; | |

View File

@ -18,7 +18,7 @@ export declare function trim(val: string, max: number, tail?: string): string;
| --- | --- | --- |
| val | string | |
| max | number | |
| tail | string | |
| tail | string | <i>(Optional)</i> |
<b>Returns:</b>

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use `deferUntil` instead
>
<b>Signature:</b>

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> there are better libraries for this, like zx
>
<b>Signature:</b>

View File

@ -4,6 +4,7 @@
## writeInput() function
<b>Signature:</b>
```typescript

View File

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> call `writeInput` directly instead
>
<b>Signature:</b>

349
docs/js-utils.api.md Normal file
View File

@ -0,0 +1,349 @@
## API Report File for "@apextoaster/js-utils"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
/// <reference types="node" />
import { BaseError } from 'noicejs';
import { ChildProcessWithoutNullStreams } from 'child_process';
import { Logger } from 'noicejs';
import { spawn } from 'child_process';
import { Writable } from 'stream';
// @public (undocumented)
export type AllowedBufferEncoding = 'ascii' | 'utf-8';
// @public
export class ArrayMapper {
constructor(options: ArrayMapperOptions);
map(input: Array<string>): Map<string, Array<string>>;
// (undocumented)
readonly rest: string;
// (undocumented)
readonly skip: number;
// (undocumented)
readonly take: Array<string>;
}
// @public (undocumented)
export interface ArrayMapperOptions {
rest: string;
skip: number;
take: Array<string>;
}
// @public
export class Checklist<T> implements ChecklistOptions<T> {
constructor(options: ChecklistOptions<T>);
check(value: T): boolean;
readonly data: Array<T>;
// (undocumented)
readonly mode: ChecklistMode;
}
// @public
export enum ChecklistMode {
// (undocumented)
EXCLUDE = "exclude",
// (undocumented)
INCLUDE = "include"
}
// @public
export interface ChecklistOptions<T> {
// (undocumented)
data: Array<T>;
// (undocumented)
mode: ChecklistMode;
}
// Warning: (ae-forgotten-export) The symbol "ChildProcessOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface ChildOptions extends ChildProcessOptions {
// (undocumented)
args: Array<string>;
// (undocumented)
command: string;
}
// @public
export class ChildProcessError extends BaseError {
constructor(msg?: string, ...nested: Array<Error>);
}
// @public (undocumented)
export interface ChildResult {
// (undocumented)
status: number;
// (undocumented)
stderr: string;
// (undocumented)
stdout: string;
}
// Warning: (ae-forgotten-export) The symbol "ChildStreams" needs to be exported by the entry point index.d.ts
//
// @public @deprecated
export function childResult(child: ChildStreams): Promise<ChildResult>;
// @public (undocumented)
export type ChildSpawner = typeof spawn;
// @public
export function concat(chunks: Array<Buffer>): Buffer;
// Warning: (ae-forgotten-export) The symbol "Reflectable" needs to be exported by the entry point index.d.ts
//
// @public
export function constructorName(val: Reflectable): string;
// @public
export function defaultWhen<TVal>(condition: boolean, ...items: Array<TVal>): TVal;
// @public
export function defer(ms: number): Promise<void>;
// Warning: (ae-forgotten-export) The symbol "PredicateC0" needs to be exported by the entry point index.d.ts
//
// @public
export function deferUntil(cb: PredicateC0, step: number, max: number): Promise<void>;
// @public
export function deferValue<T>(ms: number, val: T): Promise<T>;
// @public (undocumented)
export interface Dict<TVal> {
// (undocumented)
[key: string]: TVal;
}
// @public
export function doesExist<T>(val: Maybe<T>): val is T;
// @public
export function encode(chunks: Array<Buffer>, encoding: AllowedBufferEncoding): string;
// @public @deprecated (undocumented)
export function ensureArray<T>(val: Maybe<Array<T>>): Array<T>;
// @public (undocumented)
export function ensureArray<T>(val: Maybe<ReadonlyArray<T>>): ReadonlyArray<T>;
// @public
export function entriesOf<TVal>(map: Maybe<MapLike<TVal>>): Array<[string, TVal]>;
// @public
export function filterZip<T1>(cb: (a: T1) => boolean, l1: Array<T1>): Array<T1>;
// @public (undocumented)
export function filterZip<T1, T2>(cb: (a: T1, b: T2) => boolean, l1: Array<T1>, l2: Array<T2>): [Array<T1>, Array<T2>];
// @public (undocumented)
export function filterZip<T1, T2, T3>(cb: (a: T1, b: T2) => boolean, l1: Array<T1>, l2: Array<T2>, l3: Array<T3>): [Array<T1>, Array<T2>, Array<T3>];
// @public (undocumented)
export function filterZip<T1, T2, T3, T4>(cb: (a: T1, b: T2) => boolean, l1: Array<T1>, l2: Array<T2>, l3: Array<T3>, l4: Array<T4>): [Array<T1>, Array<T2>, Array<T3>, Array<T4>];
// @public
export function getConstructor(val: Reflectable): Function;
// @public
export function getHead<TKey, TVal>(map: Map<TKey, ReadonlyArray<TVal>>, key: TKey): TVal;
// @public
export function getHeadOrDefault<TKey, TVal>(map: Map<TKey, ReadonlyArray<Maybe<TVal>>>, key: TKey, defaultValue: TVal): TVal;
// Warning: (ae-forgotten-export) The symbol "Method" needs to be exported by the entry point index.d.ts
//
// @public
export function getMethods<TValue extends Reflectable>(value: TValue): Set<Method<TValue>>;
// @public
export function getOrDefault<TKey, TVal>(map: Map<TKey, TVal>, key: TKey, defaultValue: TVal): TVal;
// @public
export function getTestLogger(verbose?: boolean): Logger;
// @public
export function hasItems<T>(val: Maybe<Array<T>>): val is Array<T>;
// @public (undocumented)
export function hasItems<T>(val: Maybe<ReadonlyArray<T>>): val is ReadonlyArray<T>;
// @public
export class InvalidArgumentError extends BaseError {
constructor(msg?: string, ...nested: Array<Error>);
}
// @public
export function isArray<TVal>(list: TVal | Array<TVal>): list is Array<TVal>;
// @public
export function isArray<TVal>(list: TVal | ReadonlyArray<TVal>): list is ReadonlyArray<TVal>;
// Warning: (ae-internal-missing-underscore) The name "isDebug" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export function isDebug(): boolean;
// @public
export function isEmpty(val: Maybe<Array<unknown> | ReadonlyArray<unknown>>): boolean;
// @public @deprecated
export function isNil<T>(val: Maybe<T>): val is Nil;
// @public
export function isNone<T>(val: Maybe<T>): val is None;
// @public
export function isSome<T>(val: Maybe<T>): val is T;
// @public
export function leftPad(val: string, min?: number, fill?: string): string;
// @public
export function lengthOf(val: Maybe<unknown>): number;
// @public
export function makeDict<TVal>(map: Maybe<MapLike<TVal>>): Dict<TVal>;
// @public
export function makeMap<TVal>(val: Maybe<MapLike<TVal>>): Map<string, TVal>;
// @public
export type MapLike<TVal> = Map<string, TVal> | Dict<TVal>;
// @public
export type Maybe<T> = T | None;
// @public
export function mergeArray<TItem>(...parts: Array<TItem | Array<TItem>>): Array<TItem>;
// @public (undocumented)
export function mergeArray<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<TItem>>): ReadonlyArray<TItem>;
// @public @deprecated (undocumented)
export function mergeArrays<TItem>(...parts: Array<TItem | Array<TItem>>): Array<TItem>;
// @public (undocumented)
export function mergeArrays<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<TItem>>): ReadonlyArray<TItem>;
// @public
export function mergeMap<TKey, TVal>(target: Map<TKey, TVal>, source: Map<TKey, TVal> | ReadonlyArray<[TKey, TVal]>): Map<TKey, TVal>;
// @public
export class MissingKeyError extends NotFoundError {
constructor(msg?: string, ...nested: Array<Error>);
}
// @public @deprecated
export function mustCoalesce<T>(...values: Array<Maybe<T>>): T;
// @public
export function mustDefault<T>(...values: Array<Maybe<T>>): T;
// @public
export function mustExist<T>(val: Maybe<T>, err?: string): T;
// Warning: (ae-forgotten-export) The symbol "PredicateC1" needs to be exported by the entry point index.d.ts
//
// @public
export function mustFind<TVal>(list: Array<Maybe<TVal>>, predicate: PredicateC1<TVal>): TVal;
// @public
export function mustGet<TKey, TVal>(map: Map<TKey, TVal>, key: TKey): TVal;
// @public @deprecated
export type Nil = None;
// @public
export type None = null | undefined;
// @public @deprecated
export function normalizeMap(map: MapLike<unknown>): Dict<Array<string>>;
// @public
export class NotFoundError extends BaseError {
constructor(msg?: string, ...nested: Array<Error>);
}
// @public
export class NotImplementedError extends BaseError {
constructor(msg?: string, ...nested: Array<Error>);
}
// @public @deprecated
export type Optional<T> = Maybe<T>;
// Warning: (ae-forgotten-export) The symbol "NameValuePair" needs to be exported by the entry point index.d.ts
//
// @public
export function pairsToMap<TVal>(pairs: ReadonlyArray<NameValuePair<TVal>>): Map<string, TVal>;
// @public
export function pushMergeMap<TKey, TVal>(...args: Array<Map<TKey, TVal | Array<TVal>>>): Map<TKey, Array<TVal>>;
// @public
export function pushMergeMap<TKey, TVal>(...args: ReadonlyArray<Map<TKey, TVal | ReadonlyArray<TVal>>>): Map<TKey, ReadonlyArray<TVal>>;
// @public
export function removeNone<TItem>(list: ArrayLike<Maybe<TItem>>): Array<TItem>;
// @public
export function setOrPush<TKey, TVal>(map: Map<TKey, ReadonlyArray<TVal>>, key: TKey, val: TVal | ReadonlyArray<TVal>): Map<TKey, ReadonlyArray<TVal>>;
// @public
export function signal(...signals: Array<NodeJS.Signals>): Promise<NodeJS.Signals>;
// @public (undocumented)
export const SIGNAL_RELOAD: NodeJS.Signals;
// @public (undocumented)
export const SIGNAL_RESET: NodeJS.Signals;
// @public (undocumented)
export const SIGNAL_STOP: NodeJS.Signals;
// Warning: (ae-internal-missing-underscore) The name "spyLogger" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export function spyLogger(spies: Partial<Logger>): Logger;
// @public
export function sum(a: number, b: number): number;
// @public
export function timeout<T>(ms: number, inner: Promise<T>): Promise<T>;
// @public
export class TimeoutError extends BaseError {
constructor(msg?: string, ...nested: Array<Error>);
}
// @public
export function toArray<TVal>(val: Maybe<TVal | Array<TVal>>): Array<TVal>;
// @public
export function toArray<TVal>(val: Maybe<TVal | ReadonlyArray<TVal>>): ReadonlyArray<TVal>;
// @public
export function trim(val: string, max: number, tail?: string): string;
// @public @deprecated (undocumented)
export function waitFor(cb: PredicateC0, step: number, tries: number): Promise<void>;
// @public @deprecated (undocumented)
export function waitForChild(child: ChildStreams): Promise<ChildResult>;
// @public (undocumented)
export function writeInput(stream: Writable, value: string): Promise<boolean>;
// @public @deprecated (undocumented)
export function writeValue(stream: Writable, value: string): Promise<boolean>;
// (No @packageDocumentation comment for this package)
```

View File

@ -6,6 +6,9 @@ import { doesExist, isNone, Maybe } from './Maybe.js';
* @public
*/
export function mergeArray<TItem>(...parts: Array<TItem | Array<TItem>>): Array<TItem>;
/**
* @public
*/
export function mergeArray<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<TItem>>): ReadonlyArray<TItem>;
export function mergeArray<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<TItem>>): ReadonlyArray<TItem> {
const out = [];
@ -26,6 +29,9 @@ export function mergeArray<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<
* @public
*/
export function mergeArrays<TItem>(...parts: Array<TItem | Array<TItem>>): Array<TItem>;
/**
* @public
*/
export function mergeArrays<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<TItem>>): ReadonlyArray<TItem>;
export function mergeArrays<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<TItem>>): ReadonlyArray<TItem> {
return mergeArray(...parts);
@ -42,6 +48,9 @@ export function mergeArrays<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray
* @public
*/
export function hasItems<T>(val: Maybe<Array<T>>): val is Array<T>;
/**
* @public
*/
export function hasItems<T>(val: Maybe<ReadonlyArray<T>>): val is ReadonlyArray<T>;
export function hasItems<T>(val: Maybe<ReadonlyArray<T>>): val is ReadonlyArray<T> {
return isArray(val) && lengthOf(val) > 0;
@ -52,6 +61,9 @@ export function hasItems<T>(val: Maybe<ReadonlyArray<T>>): val is ReadonlyArray<
* @public
*/
export function ensureArray<T>(val: Maybe<Array<T>>): Array<T>;
/**
* @public
*/
export function ensureArray<T>(val: Maybe<ReadonlyArray<T>>): ReadonlyArray<T>;
export function ensureArray<T>(val: Maybe<ReadonlyArray<T>>): ReadonlyArray<T> {
return toArray(val);
@ -112,8 +124,17 @@ export function isEmpty(val: Maybe<Array<unknown> | ReadonlyArray<unknown>>): bo
* @public
*/
export function filterZip<T1>(cb: (a: T1) => boolean, l1: Array<T1>): Array<T1>;
/**
* @public
*/
export function filterZip<T1, T2>(cb: (a: T1, b: T2) => boolean, l1: Array<T1>, l2: Array<T2>): [Array<T1>, Array<T2>];
/**
* @public
*/
export function filterZip<T1, T2, T3>(cb: (a: T1, b: T2) => boolean, l1: Array<T1>, l2: Array<T2>, l3: Array<T3>): [Array<T1>, Array<T2>, Array<T3>];
/**
* @public
*/
export function filterZip<T1, T2, T3, T4>(cb: (a: T1, b: T2) => boolean, l1: Array<T1>, l2: Array<T2>, l3: Array<T3>, l4: Array<T4>): [Array<T1>, Array<T2>, Array<T3>, Array<T4>];
export function filterZip(cb: (...d: Array<unknown>) => boolean, ...l: Array<Array<unknown>>): Array<Array<unknown>> {
const results = [];

View File

@ -19,9 +19,9 @@ export function getTestLogger(verbose = false): Logger {
* Create a spy logger using the provided methods, which returns itself as a child.
*
* @internal
* @todo ensure all methods are present by extending null logger
*/
export function spyLogger(spies: Partial<Logger>): Logger {
// TODO: ensure all methods are present by extending null logger
const logger = {
...spies,
child: () => logger,

View File

@ -1,7 +1,6 @@
/**
* Add numbers.
*
* @implements PredicateR2<number, number>
* @public
*/
export function sum(a: number, b: number): number {