1.0.0 • Published 4 years ago

ts-upsert v1.0.0

Weekly downloads
42
License
MIT
Repository
github
Last release
4 years ago

Map#upsert & WeakMap#upsert polyfill for TypeScript

This package includes the core-js polyfill for Map#upsert and WeakMap#upsert, along with TypeScript typings.

The upsert function is defined in this TC39 proposal.

Installation

npm install --save ts-upsert

Usage

import 'ts-upsert'

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

map.upsert('foo', () => 1)
map.upsert('bar', undefined, () => 2)
map.upsert('baz', () => 3, undefined)
map.upsert('qux', () => 4, () => 5)

API

The API specification is available in the TC39 proposal.