mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-01 02:33:54 +03:00
docs(invert): Ensure JSDoc visibility for invert
function (#145)
This commit is contained in:
parent
3d64af3aab
commit
23f31e748c
@ -16,9 +16,6 @@
|
|||||||
* invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }
|
* invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }
|
||||||
* invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }
|
* invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type PropertyKey = string | number | symbol;
|
|
||||||
|
|
||||||
export function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {
|
export function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {
|
||||||
const result = {} as { [key in V]: K };
|
const result = {} as { [key in V]: K };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user