ts-emplace
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Map#emplace & WeakMap#emplace polyfill for TypeScript

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.

Installation

npm install --save ts-emplace

Usage

import 'ts-emplace'

const map = new Map<string, number>()

map.emplace('foo', {
  insert (key, map) {
    return 0
  },
  update (existing, key, map) {
    return existing + 1
  }
})

API

The API specification is available in the TC39 proposal.

Package Sidebar

Install

npm i ts-emplace

Weekly Downloads

41

Version

2.0.1

License

MIT

Unpacked Size

1.5 kB

Total Files

4

Last publish

Collaborators

  • linusu