@natlibfi/marc-record-validate

8.0.7 • Public • Published

Validate and fix MARC records NPM Version Test Coverage

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @natlibfi/marc-record-validate

Weekly Downloads

337

Version

8.0.7

License

MIT

Unpacked Size

42.6 kB

Total Files

12

Last publish

Collaborators

  • natlibfi-jonollil
  • drone-melinda