# @roqueform/reset-plugin

> Manages Roqueform field initial value and dirty status.

Latest version **4.1.0** (published 2024-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @roqueform/reset-plugin
pnpm add @roqueform/reset-plugin
yarn add @roqueform/reset-plugin
bun add @roqueform/reset-plugin
```

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2024-02-06 |
| First published | 2022-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Savva Mikhalevski |
| Maintainers | smikhalevski |
| Keywords | roqueform, form, field, plugin, reset, initial, dirty |

## Links

- npm: https://www.npmjs.com/package/@roqueform/reset-plugin
- Repository: https://github.com/smikhalevski/roqueform
- Homepage: https://github.com/smikhalevski/roqueform/tree/master/packages/reset-plugin#readme
- Issues: https://github.com/smikhalevski/roqueform/issues
- npm.io page: https://npm.io/package/@roqueform/reset-plugin

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 4.1.0 (latest) — 2024-02-06
- 4.0.0 — 2024-01-30
- 3.0.1 — 2023-08-22
- 3.0.0 — 2023-03-21
- 2.0.0 — 2022-11-23
- 1.0.1 — 2022-08-12
- 1.0.0 — 2022-08-11

## README

# Reset plugin for Roqueform

Manages [Roqueform](https://github.com/smikhalevski/roqueform#readme) field initial value and dirty status.

```sh
npm install --save-prod @roqueform/reset-plugin
```

# Overview

🔎 [API documentation is available here.](https://smikhalevski.github.io/roqueform/modules/reset_plugin.html)

Update the initial value of a field:

```ts
import { createField } from 'roqueform';
import { resetPlugin } from '@roqueform/reset-plugin';

const planetField = createField({ name: 'Pluto' }, resetPlugin());

planetField.setInitialValue({ name: 'Mars' });

planetField.at('name').initialValue;
// ⮕ 'Mars'
```

The field is considered dirty when its value differs from the initial value. Values are compared using an equality
checker function passed to the `resetPlugin`. By default, values are compared using
[fast-deep-equal](https://github.com/epoberezkin/fast-deep-equal).

```ts
planetField.at('name').isDirty // ⮕ true
```

Get the array of all dirty fields:

```ts
planetField.getDirtyFields();
// ⮕ [planetField.at('name')]
```

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