@natlibfi/marc-record-validate
v8.0.12
Published
Validate and fix MARC records
Downloads
912
Readme
Validate and fix MARC records
Javascript module to validate and fix MARC records.
Usage
import {DoubleCommas} from '@natlibfi/marc-record-validators-melinda';
import validateFactory from '@natlibfi/marc-record-validate';
async function run() {
const validate = validateFactory([await DoubleCommas()]);
const result = await validate(marcRecord);
}
Configuration
The module returns a factory function that takes an array of validators as an argument. The factory creates a validate function that takes a MARC record instance and optional options as an object:
- fix: Whether to run fix-method of the validator or not. Defaults to false
- failOnError: Do not running remaining validators if the record does not validate (And cannot be fixed if fix is set to true). Defaults to false
- validateFixes: Re-run validators after all validators have been processed. Only the validate-method will be called so that fixes are not applied twice. Defaults to false
Validators
See marc-record-validators-melinda for reference on how to write validators.
License and copyright
Copyright (c) 2014-2019, 2022-2024 University Of Helsinki (The National Library Of Finland)
This project's source code is licensed under the terms of MIT or any later version.