@augment-vir/common
Version:
A collection of augments, helpers types, functions, and classes for any JavaScript environment.
32 lines (31 loc) • 1.8 kB
TypeScript
import { type CompleteRequire } from '@augment-vir/core';
/**
* Gets an object's entries. This is the same as
* [`Object.entries`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/entries)
* except that it has better TypeScript types.
*
* @category Object
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare function getObjectTypedEntries<const ObjectGeneric>(input: ObjectGeneric): [keyof ObjectGeneric, CompleteRequire<ObjectGeneric>[keyof CompleteRequire<ObjectGeneric>]][];
/**
* Create an object from an array of entries. This is the same as
* [`Object.fromEntries`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries)
* except that it has better TypeScript types.
*
* @category Object
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare function typedObjectFromEntries<const KeyType extends PropertyKey, const ValueType>(entries: ReadonlyArray<Readonly<[KeyType, ValueType]>>): Record<KeyType, ValueType>;
/**
* Gets an object's entries and sorts them by their key values. This is the same as
* [`Object.entries`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/entries)
* except that it has better TypeScript types and sorts the entries.
*
* @category Object
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare function getEntriesSortedByKey<const ObjectGeneric>(input: ObjectGeneric): [keyof ObjectGeneric, CompleteRequire<ObjectGeneric>[keyof CompleteRequire<ObjectGeneric>]][];