Skip to main content

asArray()

@hyperledger/identus-sdk v8.1.3


@hyperledger/identus-sdk / overview / Domain / asArray

Function: asArray()

Call Signature​

asArray<T>(items: Nil | T | T[]): T[]

Defined in: packages/shared/domain/build/index.d.ts:179

asArray convert a value to an array

Type Parameters​

Type Parameter
T

Parameters​

ParameterTypeDescription
itemsNil | T | T[]the value to be converted - nullish returns empty array - single item returns array with item - array returns array

Returns​

T[]

Call Signature​

asArray<T, U>(items: Nil | T | T[], guard: (item: unknown) => item is U): U[]

Defined in: packages/shared/domain/build/index.d.ts:186

asArray convert a value to an array with type guard

Type Parameters​

Type Parameter
T
U

Parameters​

ParameterTypeDescription
itemsNil | T | T[]the value to be converted
guard(item: unknown) => item is UTypeguard to filter items ensuring item types

Returns​

U[]