# undate

> Undoable update for HTMLTextAreaElement

Latest version **0.3.0** (published 2018-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install undate
pnpm add undate
yarn add undate
bun add undate
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2018-04-18 |
| First published | 2017-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Yuku Takahashi |
| Maintainers | yuku-t |
| Keywords | textarea |

## Links

- npm: https://www.npmjs.com/package/undate
- Repository: https://github.com/yuku-t/undate
- Homepage: https://github.com/yuku-t/undate#readme
- Issues: https://github.com/yuku-t/undate/issues
- npm.io page: https://npm.io/package/undate

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 0.3.0 (latest) — 2018-04-18
- 0.2.4 — 2018-01-24
- 0.2.3 — 2017-10-29
- 0.2.2 — 2017-08-31
- 0.2.1 — 2017-07-05
- 0.2.0 — 2017-07-03
- 0.1.2 — 2017-06-28
- 0.1.1 — 2017-06-28
- 0.1.0 — 2017-06-28

## README

# undate

Undoable update for HTMLTextAreaElement

[![NPM version](http://img.shields.io/npm/v/undate.svg)](https://www.npmjs.com/package/undate)
[![Build Status](https://travis-ci.org/yuku-t/undate.svg?branch=master)](https://travis-ci.org/yuku-t/undate)
[![Code Climate](https://codeclimate.com/github/yuku-t/undate/badges/gpa.svg)](https://codeclimate.com/github/yuku-t/undate)

## Install

```bash
npm install --save undate
```

## Usage

```js
import {update, wrapCursor} from 'undate';

const textareaElement = document.getElementById('textarea');

textareaElement.value; //=> ''

// Update whole value
update(textareaElement, 'string before cursor', 'optional string after cursor');

textareaElement.value; //=> 'string before cursoroptional string after cursor'

// Update around the cursor
wrapCursor(textareaElement, ' _', '_ ');

textareaElement.value; //=> 'string before cursor __ optional string after cursor'

// Press cmd-z

textareaElement.value; //=> 'string before cursoroptional string after cursor'

textareaElement.setSelectionRange(14, 27);

textareaElement.value; //=> 'string before cursoroptional string after cursor'
                       //                  ^^^^^^^^^^^^^^ selected

wrapCursor(textareaElement, '**', '**');

textareaElement.value; //=> 'string before **cursoroptional** string after cursor'
                       //                    ^^^^^^^^^^^^^^ selected

// Press cmd-z

textareaElement.value; //=> 'string before cursoroptional string after cursor'
                       //                  ^^^^^^^^^^^^^^ selected

// Press cmd-z

textareaElement.value; //=> ''
```

## License

The [MIT](https://github.com/yuku-t/undate/blob/master/LICENSE) License

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