# ts-emplace

> This package includes the [core-js](https://github.com/zloirock/core-js) polyfill for `Map#emplace` and `WeakMap#emplace`, along with TypeScript typings.

Latest version **2.0.1** (published 2023-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-emplace
pnpm add ts-emplace
yarn add ts-emplace
bun add ts-emplace
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2023-11-27 |
| First published | 2022-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | linusu |
| Keywords | emplace, Map, polyfill, upsert, WeakMap |

## Links

- npm: https://www.npmjs.com/package/ts-emplace
- Repository: https://github.com/LinusU/ts-emplace
- Homepage: https://github.com/LinusU/ts-emplace#readme
- Issues: https://github.com/LinusU/ts-emplace/issues
- npm.io page: https://npm.io/package/ts-emplace

## Dependencies (1)

- [core-js](https://npm.io/package/core-js.md) ^3.23.4

## Recent versions

- 2.0.1 (latest) — 2023-11-27
- 2.0.0 — 2022-09-23

## README

# `Map#emplace` & `WeakMap#emplace` polyfill for TypeScript

This package includes the [core-js](https://github.com/zloirock/core-js) polyfill for `Map#emplace` and `WeakMap#emplace`, along with TypeScript typings.

The `emplace` function is defined in [this TC39 proposal](https://github.com/tc39/proposal-upsert).

## Installation

```sh
npm install --save ts-emplace
```

## Usage

```typescript
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](https://github.com/tc39/proposal-upsert).

---
_Source: https://npm.io/package/ts-emplace · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
