Module: @divine/commons
Classes
Interfaces
Type Aliases
BasicTypes
Ƭ BasicTypes: boolean
| number
| bigint
| string
| object
| null
Defined in
Constructor
Ƭ Constructor<T
>: (...args
: any
[]) => T
Type parameters
Name |
---|
T |
Type declaration
• (...args
)
Parameters
Name | Type |
---|---|
...args | any [] |
Defined in
ValueEncoder
Ƭ ValueEncoder: (value
: string
, key
: string
| number
) => string
Type declaration
▸ (value
, key
): string
Parameters
Name | Type |
---|---|
value | string |
key | string | number |
Returns
string
Defined in
Functions
as
▸ as<T
>(value
): T
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
value | T |
Returns
T
Defined in
b64Decode
▸ b64Decode(b64
): string
Parameters
Name | Type |
---|---|
b64 | string |
Returns
string
Defined in
b64Encode
▸ b64Encode(str
): string
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
copyStream
▸ copyStream(from
, to
): Promise
<typeof to
>
Parameters
Name | Type |
---|---|
from | ReadableStream |
to | WritableStream |
Returns
Promise
<typeof to
>
Defined in
es6Encoder
▸ es6Encoder(strings
, values
, encoder
): string
Parameters
Name | Type |
---|---|
strings | TemplateStringsArray |
values | unknown [] |
encoder | ValueEncoder |
Returns
string
Defined in
escapeRegExp
▸ escapeRegExp(str
): string
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
esxxEncoder
▸ esxxEncoder(template
, params
, encoder
): string
Parameters
Name | Type |
---|---|
template | string |
params | Params |
encoder | ValueEncoder |
Returns
string
Defined in
isAsyncIterable
▸ isAsyncIterable<T
>(object
): object is AsyncIterable<T>
Type parameters
Name | Type |
---|---|
T | unknown |
Parameters
Name | Type |
---|---|
object | any |
Returns
object is AsyncIterable<T>
Defined in
commons/src/async-iterable.ts:8
isDOMNode
▸ isDOMNode(obj
): boolean
Parameters
Name | Type |
---|---|
obj | unknown |
Returns
boolean
Defined in
isHTML
▸ isHTML(obj
): boolean
Parameters
Name | Type |
---|---|
obj | unknown |
Returns
boolean
Defined in
isJSON
▸ isJSON(obj
): boolean
Parameters
Name | Type |
---|---|
obj | unknown |
Returns
boolean
Defined in
isOneOf
▸ isOneOf<T
, V
>(value
, of
): boolean
Type parameters
Name | Type |
---|---|
T | extends string | number |
V | extends T [] |
Parameters
Name | Type |
---|---|
value | undefined | T |
of | V |
Returns
boolean
Defined in
isReadableStream
▸ isReadableStream(obj
): obj is ReadableStream & AsyncIterable<string | Buffer>
Parameters
Name | Type |
---|---|
obj | any |
Returns
obj is ReadableStream & AsyncIterable<string | Buffer>
Defined in
isTemplateStringsLike
▸ isTemplateStringsLike(strings
): strings is TemplateStringsArray
Parameters
Name | Type |
---|---|
strings | any |
Returns
strings is TemplateStringsArray
Defined in
isXML
▸ isXML(obj
): boolean
Parameters
Name | Type |
---|---|
obj | unknown |
Returns
boolean
Defined in
mapped
▸ mapped<T
, TReturn
, TNext
, R
>(it
, fn
): AsyncGenerator
<R
, TReturn
, TNext
>
Type parameters
Name |
---|
T |
TReturn |
TNext |
R |
Parameters
Name | Type |
---|---|
it | AsyncGenerator <T , TReturn , TNext > |
fn | (value : T ) => R | Promise <R > |
Returns
AsyncGenerator
<R
, TReturn
, TNext
>
Defined in
commons/src/async-iterable.ts:76
▸ mapped<T
, TReturn
, TNext
, R
>(it
, fn
): ExtAsyncIterableIterator
<R
, TReturn
, TNext
>
Type parameters
Name |
---|
T |
TReturn |
TNext |
R |
Parameters
Name | Type |
---|---|
it | AsyncIterator <T , TReturn , TNext > | AsyncIterable <T > |
fn | (value : T ) => R | Promise <R > |
Returns
ExtAsyncIterableIterator
<R
, TReturn
, TNext
>
Defined in
commons/src/async-iterable.ts:77
percentEncode
▸ percentEncode(str
): string
Percent-encode everything except 0-9, A-Z, a-z, -
, _
, .
, !
and ~
.
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
setProp
▸ setProp<T
, K
>(object
, prop
, value
): T
Type parameters
Name | Type |
---|---|
T | extends object |
K | extends string | number | symbol |
Parameters
Name | Type |
---|---|
object | T |
prop | K |
value | T [K ] |
Returns
T
Defined in
sleep
▸ sleep(ms
): Promise
<void
>
Parameters
Name | Type |
---|---|
ms | number |
Returns
Promise
<void
>
Defined in
throwError
▸ throwError(err
): never
Parameters
Name | Type |
---|---|
err | Error |
Returns
never
Defined in
toAsyncIterable
▸ toAsyncIterable(data
): AsyncIterable
<Buffer
>
Parameters
Name | Type |
---|---|
data | string | Buffer | AsyncIterable <string | Buffer > |
Returns
AsyncIterable
<Buffer
>
Defined in
commons/src/async-iterable.ts:12
toReadableStream
▸ toReadableStream(data
): Readable
& AsyncIterable
<Buffer
>
Parameters
Name | Type |
---|---|
data | string | Buffer | AsyncIterable <string | Buffer > |
Returns
Readable
& AsyncIterable
<Buffer
>
Defined in
unblocked
▸ unblocked<T
, TReturn
, TNext
>(it
, timeout
): AsyncGenerator
<T
| undefined
, TReturn
, TNext
>
Type parameters
Name |
---|
T |
TReturn |
TNext |
Parameters
Name | Type |
---|---|
it | AsyncGenerator <T , TReturn , TNext > |
timeout | number |
Returns
AsyncGenerator
<T
| undefined
, TReturn
, TNext
>
Defined in
commons/src/async-iterable.ts:96
▸ unblocked<T
, TReturn
, TNext
>(it
, timeout
): ExtAsyncIterableIterator
<T
| undefined
, TReturn
, TNext
>
Type parameters
Name |
---|
T |
TReturn |
TNext |
Parameters
Name | Type |
---|---|
it | AsyncIterator <T , TReturn , TNext > | AsyncIterable <T > |
timeout | number |
Returns
ExtAsyncIterableIterator
<T
| undefined
, TReturn
, TNext
>