npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@natlibfi/marc-record-merge

v7.0.2

Published

Merge MARC records

Downloads

489

Readme

Merge MARC records NPM Version

Merge MARC records

Usage

COPY

Chosing fields for reducer:

const copyReducerConfigs = [
    {tagPattern: /010/u},
    {tagPattern: /010|020/u},
    {tagPattern: new RegExp('010', 'u')},
    {tagPattern: new RegExp(String((/^(?<tags1>010|020$)/u').source))},
  ]

compareTagsOnly (Defaults false)

{tagPattern: /010/u, compareTagsOnly: false}

If base has field with that tag source field is ignored

doNotCopyIfFieldPresent (Defaults false)

{tagPattern: /010/u, doNotCopyIfFieldPresent: "^011$"}

If base has field with that tag 011 source field is ignored

compareWithoutIndicators (Defaults false)

{tagPattern: /010/u, compareWithoutIndicators: false}

When base and source fields are compared, indicator differences are ignored

compareWithoutTag (Defaults false)

{tagPattern: /^(100|700)$/u, compareWithoutTag: false}
{tagPattern: /^(100|700)$/u, compareWithoutTag: false, swapTag: [{"from": "^100$", "to": "700"}]}

When base and source fields are compared, tag differences are ignored

subfieldsMustBeIdentical (Defaults true)

{tagPattern: /010/u, subfieldsMustBeIdentical: true}

If source subfields are subset of base subfields this option says if it is copied | subfieldsMustBeIdentical | base | source | copy | |--------------------------|---------------|---------------|-------| | true or false | $a foo | $a foo | false | | true or false | $a foo | $b bar | true | | true | $a foo | $a foo,$b bar | true | | false | $a foo | $a foo,$b bar | true | | true | $a foo,$b bar | $a foo | true | | false | $a foo,$b bar | $a foo | false |

excludeSubfields (Defaults [ ])

{tagPattern: /010/u, excludeSubfields: ['a']}

When base and source fields are compared, excluded subfields are ignored

swapTag (Defaults [ ])

{tagPattern: /^100$/u, swapTag: [{"from": "^100$", "to": "700"}]}
{tagPattern: /^(100|700)$/u, compareWithoutTag: false, swapTag: [{"from": "^100$", "to": "700"}]}

When fields are copied, tags are swapped. From is Regexp filter and to is string value.

swapSubfieldCode (Defaults [ ])

{tagPattern: /010/u, swapSubfieldCode: [{"from": "a", "to": "b"}]}

When source fields are copied, subfields are checkked and if subfield.code match to 'from' value is that code swapped to 'to' value

dropSubfields (Defaults [ ])

{tagPattern: /010/u, dropSubfields: [{"code": "9"}]}

Drops subfields 9's from all fields tagged 010

{tagPattern: /010/u, dropSubfields: [{"code": "9", "value": "FENNI<KEEP>"}]}

Drops subfields 9's that have "FENNI" from all fields tagged 010

{tagPattern: /010/u, dropSubfields: [{"code": "9", "condition": "unless", "value": "^FENNI<(?<option>KEEP|DROP)>$"}]}

Drops all subfield 9's unless they have "FENNI" or "FENNI" from all fields tagged 010

When comparing or copying field dropped fields are ignored

copyUnless (Defaults [ ])

{tagPattern: /010/u, copyUnless: [{"code": "9", "value": "FENNI<KEEP>"}]}

When field is otherwise ok to be copied, if it contains given subfield whole field is ignored

baseValidators (Defaults {subfieldValues: false})

{tagPattern: /010/u, baseValidators: {fields: true, subfields: true, subfieldValues: true}}

Marc record validators for base record while reducer is working. More info can be read here: https://github.com/NatLibFi/marc-record-js

sourceValidators (Defaults {subfieldValues: false})

{tagPattern: /010/u, sourceValidators: {fields: true, subfields: true, subfieldValues: true}}

Marc record validators for source record while reducer is working. More info can be read here: https://github.com/NatLibFi/marc-record-js

License and copyright

Copyright (c) 2020-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.