fix: export missing symbols
This commit is contained in:
parent
e18f65a049
commit
52e08220e8
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [AllowedBufferEncoding](./js-utils.allowedbufferencoding.md)
|
||||
|
||||
## AllowedBufferEncoding type
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type AllowedBufferEncoding = 'ascii' | 'utf-8';
|
||||
```
|
|
@ -0,0 +1,23 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [deferValue](./js-utils.defervalue.md)
|
||||
|
||||
## deferValue() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function deferValue<T>(ms: number, val: T): Promise<T>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| ms | number | |
|
||||
| val | T | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<T>
|
||||
|
|
@ -17,7 +17,7 @@ export declare function encode(chunks: Array<Buffer>, encoding: AllowedBufferEnc
|
|||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| chunks | Array<Buffer> | |
|
||||
| encoding | AllowedBufferEncoding | |
|
||||
| encoding | [AllowedBufferEncoding](./js-utils.allowedbufferencoding.md) | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [filterZip](./js-utils.filterzip.md)
|
||||
|
||||
## filterZip() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function filterZip<T1>(cb: (a: T1) => boolean, l1: Array<T1>): Array<T1>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cb | (a: T1) => boolean | |
|
||||
| l1 | Array<T1> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Array<T1>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [filterZip](./js-utils.filterzip_1.md)
|
||||
|
||||
## filterZip() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function filterZip<T1, T2>(cb: (a: T1, b: T2) => boolean, l1: Array<T1>, l2: Array<T2>): [Array<T1>, Array<T2>];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cb | (a: T1, b: T2) => boolean | |
|
||||
| l1 | Array<T1> | |
|
||||
| l2 | Array<T2> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
\[Array<T1>, Array<T2>\]
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [filterZip](./js-utils.filterzip_2.md)
|
||||
|
||||
## filterZip() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare 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>];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cb | (a: T1, b: T2) => boolean | |
|
||||
| l1 | Array<T1> | |
|
||||
| l2 | Array<T2> | |
|
||||
| l3 | Array<T3> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
\[Array<T1>, Array<T2>, Array<T3>\]
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [filterZip](./js-utils.filterzip_3.md)
|
||||
|
||||
## filterZip() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare 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>];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cb | (a: T1, b: T2) => boolean | |
|
||||
| l1 | Array<T1> | |
|
||||
| l2 | Array<T2> | |
|
||||
| l3 | Array<T3> | |
|
||||
| l4 | Array<T4> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
\[Array<T1>, Array<T2>, Array<T3>, Array<T4>\]
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [isArray](./js-utils.isarray.md)
|
||||
|
||||
## isArray() function
|
||||
|
||||
Wrapper for `Array.isArray` with better readonly type handling.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function isArray<TVal>(list: TVal | Array<TVal>): list is Array<TVal>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| list | TVal \| Array<TVal> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
list is Array<TVal>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [isArray](./js-utils.isarray_1.md)
|
||||
|
||||
## isArray() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function isArray<TVal>(list: TVal | ReadonlyArray<TVal>): list is ReadonlyArray<TVal>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| list | TVal \| ReadonlyArray<TVal> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
list is ReadonlyArray<TVal>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [isEmpty](./js-utils.isempty.md)
|
||||
|
||||
## isEmpty() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function isEmpty(val: Maybe<Array<unknown> | ReadonlyArray<unknown>>): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | [Maybe](./js-utils.maybe.md)<!-- --><Array<unknown> \| ReadonlyArray<unknown>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
boolean
|
||||
|
|
@ -31,11 +31,16 @@
|
|||
| [constructorName(val)](./js-utils.constructorname.md) | Get the constructor name from an instance. |
|
||||
| [defaultWhen(condition, items)](./js-utils.defaultwhen.md) | Return the first element when <code>condition</code> is true and the second element when <code>condition</code> is false. |
|
||||
| [defer(ms)](./js-utils.defer.md) | Resolve after a set amount of time. |
|
||||
| [deferValue(ms, val)](./js-utils.defervalue.md) | |
|
||||
| [doesExist(val)](./js-utils.doesexist.md) | Check if a variable is some <code>T</code>. |
|
||||
| [encode(chunks, encoding)](./js-utils.encode.md) | Concatenate then encode a list of buffers. |
|
||||
| [ensureArray(val)](./js-utils.ensurearray.md) | |
|
||||
| [ensureArray(val)](./js-utils.ensurearray_1.md) | |
|
||||
| [entriesOf(map)](./js-utils.entriesof.md) | Get entries of a map-like. |
|
||||
| [filterZip(cb, l1)](./js-utils.filterzip.md) | |
|
||||
| [filterZip(cb, l1, l2)](./js-utils.filterzip_1.md) | |
|
||||
| [filterZip(cb, l1, l2, l3)](./js-utils.filterzip_2.md) | |
|
||||
| [filterZip(cb, l1, l2, l3, l4)](./js-utils.filterzip_3.md) | |
|
||||
| [getConstructor(val)](./js-utils.getconstructor.md) | Get the constructor from an instance. |
|
||||
| [getHead(map, key)](./js-utils.gethead.md) | Get the first element from the specified key within a map of lists. |
|
||||
| [getHeadOrDefault(map, key, defaultValue)](./js-utils.getheadordefault.md) | Get the first element from the specified key, within a map of lists, or a default value when the key does not exist or is nil. |
|
||||
|
@ -44,7 +49,10 @@
|
|||
| [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 (length > 0).<!-- -->This is not a general replacement for <code>.length > 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_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) | |
|
||||
| [isDebug()](./js-utils.isdebug.md) | Test if DEBUG mode is set.<!-- -->TODO: check variable value as well |
|
||||
| [isEmpty(val)](./js-utils.isempty.md) | |
|
||||
| [isNil(val)](./js-utils.isnil.md) | Check if a value is nil. |
|
||||
| [isNone(val)](./js-utils.isnone.md) | |
|
||||
| [isSome(val)](./js-utils.issome.md) | |
|
||||
|
@ -52,6 +60,8 @@
|
|||
| [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. |
|
||||
| [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. |
|
||||
| [mergeArray(parts)](./js-utils.mergearray_1.md) | |
|
||||
| [mergeArrays(parts)](./js-utils.mergearrays.md) | |
|
||||
| [mergeArrays(parts)](./js-utils.mergearrays_1.md) | |
|
||||
| [mergeMap(target, source)](./js-utils.mergemap.md) | Merge the <code>source</code> map into the <code>target</code> map, replacing keys that already exist. |
|
||||
|
@ -68,8 +78,12 @@
|
|||
| [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) | |
|
||||
| [spyLogger(spies)](./js-utils.spylogger.md) | Create a spy logger using the provided methods, which returns itself as a child. |
|
||||
| [sum(a, b)](./js-utils.sum.md) | Add numbers. PredicateR2<!-- --><<!-- -->number, number<!-- -->> |
|
||||
| [timeout(ms, oper)](./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) | |
|
||||
| [toArray(val)](./js-utils.toarray_1.md) | |
|
||||
| [trim(val, max, tail)](./js-utils.trim.md) | |
|
||||
| [waitFor(cb, step, count)](./js-utils.waitfor.md) | Reject after a set number of attempts if the given predicate does not return true. |
|
||||
| [waitForChild(child)](./js-utils.waitforchild.md) | Wait for a child process to exit, collecting output, errors, and exit status. |
|
||||
| [writeValue(stream, value)](./js-utils.writevalue.md) | |
|
||||
|
||||
|
@ -96,6 +110,7 @@
|
|||
|
||||
| Type Alias | Description |
|
||||
| --- | --- |
|
||||
| [AllowedBufferEncoding](./js-utils.allowedbufferencoding.md) | |
|
||||
| [ChildSpawner](./js-utils.childspawner.md) | |
|
||||
| [MapLike](./js-utils.maplike.md) | A <code>Map</code> or dictionary object with string keys and <code>TVal</code> values. |
|
||||
| [Maybe](./js-utils.maybe.md) | Value that may be nil. |
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [mergeArray](./js-utils.mergearray.md)
|
||||
|
||||
## mergeArray() function
|
||||
|
||||
Merge arguments, which may or may not be arrays, into one return that is definitely an array.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function mergeArray<TItem>(...parts: Array<TItem | Array<TItem>>): Array<TItem>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| parts | Array<TItem \| Array<TItem>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Array<TItem>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [mergeArray](./js-utils.mergearray_1.md)
|
||||
|
||||
## mergeArray() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function mergeArray<TItem>(...parts: ReadonlyArray<TItem | ReadonlyArray<TItem>>): ReadonlyArray<TItem>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| parts | ReadonlyArray<TItem \| ReadonlyArray<TItem>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
ReadonlyArray<TItem>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [sum](./js-utils.sum.md)
|
||||
|
||||
## sum() function
|
||||
|
||||
Add numbers.
|
||||
|
||||
PredicateR2<!-- --><<!-- -->number, number<!-- -->>
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function sum(a: number, b: number): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| a | number | |
|
||||
| b | number | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
number
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [toArray](./js-utils.toarray.md)
|
||||
|
||||
## toArray() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function toArray<TVal>(val: Maybe<TVal | Array<TVal>>): Array<TVal>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | [Maybe](./js-utils.maybe.md)<!-- --><TVal \| Array<TVal>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Array<TVal>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [toArray](./js-utils.toarray_1.md)
|
||||
|
||||
## toArray() function
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function toArray<TVal>(val: Maybe<TVal | ReadonlyArray<TVal>>): ReadonlyArray<TVal>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | [Maybe](./js-utils.maybe.md)<!-- --><TVal \| ReadonlyArray<TVal>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
ReadonlyArray<TVal>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [waitFor](./js-utils.waitfor.md)
|
||||
|
||||
## waitFor() function
|
||||
|
||||
Reject after a set number of attempts if the given predicate does not return true.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function waitFor(cb: PredicateC0, step: number, count: number): Promise<void>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| cb | PredicateC0 | |
|
||||
| step | number | |
|
||||
| count | number | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Exceptions
|
||||
|
||||
TimeoutError
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { sum } from './Predicate';
|
||||
import { sum } from './Math';
|
||||
|
||||
export type AllowedBufferEncoding = 'ascii' | 'utf-8';
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Add numbers.
|
||||
*
|
||||
* @implements PredicateR2<number, number>
|
||||
*/
|
||||
export function sum(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
|
@ -47,12 +47,3 @@ export type PredicateR1<RVal, TVal = RVal> = (val: TVal, idx: number, list: Arra
|
|||
* @beta
|
||||
*/
|
||||
export type PredicateR2<RVal, TVal = RVal> = (pval: TVal, nval: TVal, idx: number, list: Array<TVal>) => RVal;
|
||||
|
||||
/**
|
||||
* Add numbers.
|
||||
*
|
||||
* @implements PredicateR2<number, number>
|
||||
*/
|
||||
export function sum(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
||||
|
|
30
src/index.ts
30
src/index.ts
|
@ -5,15 +5,29 @@ export { NotFoundError } from './error/NotFoundError';
|
|||
export { NotImplementedError } from './error/NotImplementedError';
|
||||
export { TimeoutError } from './error/TimeoutError';
|
||||
|
||||
export {
|
||||
mergeArray,
|
||||
mergeArrays,
|
||||
hasItems,
|
||||
ensureArray,
|
||||
toArray,
|
||||
isArray,
|
||||
isEmpty,
|
||||
filterZip,
|
||||
lengthOf,
|
||||
} from './Array';
|
||||
export {
|
||||
ArrayMapper,
|
||||
ArrayMapperOptions,
|
||||
} from './ArrayMapper';
|
||||
export {
|
||||
defer,
|
||||
deferValue,
|
||||
timeout,
|
||||
waitFor,
|
||||
} from './Async';
|
||||
export {
|
||||
AllowedBufferEncoding,
|
||||
concat,
|
||||
encode,
|
||||
} from './Buffer';
|
||||
|
@ -29,14 +43,13 @@ export {
|
|||
waitForChild,
|
||||
writeValue,
|
||||
} from './Child';
|
||||
export { ExternalModule, ModuleCtor } from './ExternalModule';
|
||||
export { isDebug } from './Env';
|
||||
export {
|
||||
ensureArray,
|
||||
hasItems,
|
||||
lengthOf,
|
||||
mergeArrays,
|
||||
} from './Array';
|
||||
isDebug
|
||||
} from './Env';
|
||||
export {
|
||||
ExternalModule,
|
||||
ModuleCtor,
|
||||
} from './ExternalModule';
|
||||
export {
|
||||
getTestLogger,
|
||||
spyLogger,
|
||||
|
@ -57,6 +70,9 @@ export {
|
|||
pushMergeMap,
|
||||
setOrPush,
|
||||
} from './Map';
|
||||
export {
|
||||
sum,
|
||||
} from './Math';
|
||||
export {
|
||||
Maybe,
|
||||
None,
|
||||
|
|
|
@ -6,7 +6,7 @@ import sinon from 'sinon';
|
|||
|
||||
import { isNone } from '../../src';
|
||||
import { ensureArray, filterZip, hasItems, isEmpty, lengthOf, mergeArray, toArray } from '../../src/Array';
|
||||
import { sum } from '../../src/Predicate';
|
||||
import { sum } from '../../src/Math';
|
||||
|
||||
const { match, stub } = sinon;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { array, uint8Array } from 'fast-check';
|
|||
import { over } from 'mocha-foam';
|
||||
|
||||
import { concat, encode } from '../../src/Buffer';
|
||||
import { sum } from '../../src/Predicate';
|
||||
import { sum } from '../../src/Math';
|
||||
|
||||
describe('buffer utils', async () => {
|
||||
describe('concat', async () => {
|
||||
|
|
Loading…
Reference in New Issue