4.1.0 ā€¢ Published 4 months ago

@roqueform/reset-plugin v4.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Reset plugin for Roqueform

Manages Roqueform field initial value and dirty status.

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

Overview

šŸ”Ž API documentation is available here.

Update the initial value of a field:

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.

planetField.at('name').isDirty // ā®• true

Get the array of all dirty fields:

planetField.getDirtyFields();
// ā®• [planetField.at('name')]
4.1.0

4 months ago

4.0.0

4 months ago

3.0.1

9 months ago

3.0.0

1 year ago

2.0.0

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago