getWithDefault and getOrThrow to Belt.HashMap, Belt.HashMap.Int and Belt.HashMap.String.Semantic Diff
1 commit, rendered from its record.
| Range | Commits | Changelog | Areas | JS output changes | Formats | Failed checks |
|---|---|---|---|---|---|---|
58da277de4eeba0d27f17c8056fd4c192e7b7ad9..pr-8926 | 1 | ๐ New feature | runtimetests | 1 | none | 0 |
getWithDefault and getOrThrow to Belt.HashMap, Belt.HashMap.Int and Belt.HashMap.String.58da277de4eeba0d27f17c8056fd4c192e7b7ad9..pr-8926Belt.HashMap, Belt.HashMap.Int and Belt.HashMap.String gain getWithDefault and getOrThrow, the same lookups Belt.Map and Belt.MutableMap already have. They walk the bucket directly, so a hit allocates no option; getOrThrow throws Not_found like the other Belt maps.
let m = Belt.HashMap.Int.fromArray([(1, "a")])m->Belt.HashMap.Int.getWithDefault(2, "z") == "z"m->Belt.HashMap.Int.getOrThrow(1) == "a"
getWithDefault and getOrThrow to Belt.HashMap, Belt.HashMap.Int and Belt.HashMap.String.| A | changes/belt-hashmap-get-with-default.feature.md | +1 | โ0 |
| M | packages/@rescript/belt/src/Belt_HashMap.res | +34 | โ0 |
| M | packages/@rescript/belt/src/Belt_HashMap.resi | +46 | โ0 |
| M | packages/@rescript/belt/src/Belt_HashMapInt.res | +34 | โ0 |
| M | packages/@rescript/belt/src/Belt_HashMapInt.resi | +32 | โ0 |
| M | packages/@rescript/belt/src/Belt_HashMapString.res | +34 | โ0 |
| M | packages/@rescript/belt/src/Belt_HashMapString.resi | +32 | โ0 |
| M | tests/belt_tests/src/belt_hashmap_test.mjs | +67 | โ0 |
| M | tests/belt_tests/src/belt_hashmap_test.res | +33 | โ0 |