map.ts

view source

Declarations
#

2 declarations

compare_simple_map_entries
#

map.ts view source

(a: [any, any], b: [any, any]): number import {compare_simple_map_entries} from '@fuzdev/fuz_util/map.js';

Compares two map entries for sorting purposes. If the key is a string, it uses localeCompare for comparison. For other types, it uses >.

a

type [any, any]

b

type [any, any]

returns

number

sort_map
#

map.ts view source

<T extends Map<any, any>>(map: T, comparator?: (a: [any, any], b: [any, any]) => number): T import {sort_map} from '@fuzdev/fuz_util/map.js';

Sorts a map by comparator, a function that compares two entries, defaulting to using localeCompare and >.

map

type T

comparator

type (a: [any, any], b: [any, any]) => number
default compare_simple_map_entries

returns

T

generics

sort_map<T extends Map<any, any>>
T
constraint Map<any, any>