Skip to content

webshrine / stdlib/src / collectionKeys

Function: collectionKeys()

collectionKeys(collection): CollectionKey[]

Returns an array of keys or indexes for the given collection.

Parameters

collection

Collection

Returns

CollectionKey[]

Example

ts
collectionKeys({ a: 1, b: 2, [Symbol('c')]: 3 }) // ['a', 'b', 'c']
collectionKeys(['a', 'b', 'c']) // [0, 1, 2]

Defined in

packages/stdlib/src/transformers/common.ts:80