This package includes the core-js polyfill for Map#emplace
and WeakMap#emplace
, along with TypeScript typings.
The emplace
function is defined in this TC39 proposal.
npm install --save ts-emplace
import 'ts-emplace'
const map = new Map<string, number>()
map.emplace('foo', {
insert (key, map) {
return 0
},
update (existing, key, map) {
return existing + 1
}
})
The API specification is available in the TC39 proposal.