Skip to content

createAttributeUpdater

createAttributeUpdater<T>(attributes, setAttributes, validate, onValidationError?): <K>(key, value) => boolean

Defined in: wp-typia-block-runtime/src/validation.ts:298

Create a shallow attribute updater that validates before committing changes.

T extends object

T

Current attribute snapshot.

(attrs) => void

Setter used to apply validated patches.

(value) => ValidationResult<T>

Validator used to check the next attribute state.

(result, key) => void

Optional callback for rejected updates.

A keyed updater that returns true when the patch is accepted.

<K>(key, value) => boolean

const update = createAttributeUpdater(attributes, setAttributes, validate);