{"id":21198820,"url":"https://github.com/natlibfi/marc-record-merge-js","last_synced_at":"2025-07-10T06:30:46.695Z","repository":{"id":29194088,"uuid":"32725253","full_name":"NatLibFi/marc-record-merge-js","owner":"NatLibFi","description":"A configurable Javascript module for merging MARC records","archived":false,"fork":false,"pushed_at":"2024-04-11T03:33:48.000Z","size":1478,"stargazers_count":3,"open_issues_count":9,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-04-14T11:41:18.385Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NatLibFi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-23T10:26:57.000Z","updated_at":"2024-04-30T05:13:10.577Z","dependencies_parsed_at":"2024-04-30T05:12:44.710Z","dependency_job_id":null,"html_url":"https://github.com/NatLibFi/marc-record-merge-js","commit_stats":{"total_commits":119,"total_committers":6,"mean_commits":"19.833333333333332","dds":0.5546218487394958,"last_synced_commit":"592ad1a8f1ff1b1ba8bdb3bda5ebbdbf9ed0b9e7"},"previous_names":["natlibfi/marc-record-merge"],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Fmarc-record-merge-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Fmarc-record-merge-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Fmarc-record-merge-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Fmarc-record-merge-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NatLibFi","download_url":"https://codeload.github.com/NatLibFi/marc-record-merge-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224873371,"owners_count":17384078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T19:53:37.973Z","updated_at":"2025-07-10T06:30:46.689Z","avatar_url":"https://github.com/NatLibFi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Merge MARC records [![NPM Version](https://img.shields.io/npm/v/@natlibfi/marc-record-merge.svg)](https://npmjs.org/package/@natlibfi/marc-record-merge)\n\nMerge MARC records\n\n## Usage\n### COPY\n\nChosing fields for reducer:\n```\nconst copyReducerConfigs = [\n    {tagPattern: /010/u},\n    {tagPattern: /010|020/u},\n    {tagPattern: new RegExp('010', 'u')},\n    {tagPattern: new RegExp(String((/^(?\u003ctags1\u003e010|020$)/u').source))},\n  ]\n```\n\n### compareTagsOnly (Defaults false)\n```\n{tagPattern: /010/u, compareTagsOnly: false}\n```\n\nIf base has field with that tag source field is ignored\n\n### doNotCopyIfFieldPresent (Defaults false)\n```\n{tagPattern: /010/u, doNotCopyIfFieldPresent: \"^011$\"}\n```\n\nIf base has field with that tag 011 source field is ignored\n\n### compareWithoutIndicators (Defaults false)\n```\n{tagPattern: /010/u, compareWithoutIndicators: false}\n```\n\nWhen base and source fields are compared, indicator differences are ignored\n\n### compareWithoutTag (Defaults false)\n```\n{tagPattern: /^(100|700)$/u, compareWithoutTag: false}\n{tagPattern: /^(100|700)$/u, compareWithoutTag: false, swapTag: [{\"from\": \"^100$\", \"to\": \"700\"}]}\n```\n\nWhen base and source fields are compared, tag differences are ignored\n\n### subfieldsMustBeIdentical (Defaults true)\n```\n{tagPattern: /010/u, subfieldsMustBeIdentical: true}\n```\n\nIf source subfields are subset of base subfields this option says if it is copied\n| subfieldsMustBeIdentical | base          | source        | copy  |\n|--------------------------|---------------|---------------|-------|\n| true or false            | $a foo        | $a foo        | false |\n| true or false            | $a foo        | $b bar        | true  |\n| true                     | $a foo        | $a foo,$b bar | true  |\n| false                    | $a foo        | $a foo,$b bar | true  |\n| true                     | $a foo,$b bar | $a foo        | true  |\n| false                    | $a foo,$b bar | $a foo        | false |\n\n### excludeSubfields (Defaults [ ])\n```\n{tagPattern: /010/u, excludeSubfields: ['a']}\n```\n\nWhen base and source fields are compared, excluded subfields are ignored\n\n### swapTag (Defaults [ ])\n```\n{tagPattern: /^100$/u, swapTag: [{\"from\": \"^100$\", \"to\": \"700\"}]}\n{tagPattern: /^(100|700)$/u, compareWithoutTag: false, swapTag: [{\"from\": \"^100$\", \"to\": \"700\"}]}\n```\n\nWhen fields are copied, tags are swapped. From is Regexp filter and to is string value.\n\n### swapSubfieldCode (Defaults [ ])\n```\n{tagPattern: /010/u, swapSubfieldCode: [{\"from\": \"a\", \"to\": \"b\"}]}\n```\n\nWhen source fields are copied, subfields are checkked and if subfield.code match to 'from' value is that code swapped to 'to' value\n\n### dropSubfields (Defaults [ ])\n```\n{tagPattern: /010/u, dropSubfields: [{\"code\": \"9\"}]}\n```\nDrops subfields 9's from all fields tagged 010\n\n```\n{tagPattern: /010/u, dropSubfields: [{\"code\": \"9\", \"value\": \"FENNI\u003cKEEP\u003e\"}]}\n```\nDrops subfields 9's that have \"FENNI\u003cKEEP\u003e\" from all fields tagged 010\n\n\n```\n{tagPattern: /010/u, dropSubfields: [{\"code\": \"9\", \"condition\": \"unless\", \"value\": \"^FENNI\u003c(?\u003coption\u003eKEEP|DROP)\u003e$\"}]}\n```\nDrops all subfield 9's unless they have \"FENNI\u003cKEEP\u003e\" or \"FENNI\u003cDROP\u003e\" from all fields tagged 010\n\n\nWhen comparing or copying field dropped fields are ignored\n\n### copyUnless (Defaults [ ])\n```\n{tagPattern: /010/u, copyUnless: [{\"code\": \"9\", \"value\": \"FENNI\u003cKEEP\u003e\"}]}\n```\n\nWhen field is otherwise ok to be copied, if it contains given subfield whole field is ignored\n\n### baseValidators (Defaults {subfieldValues: false})\n```\n{tagPattern: /010/u, baseValidators: {fields: true, subfields: true, subfieldValues: true}}\n```\n\nMarc record validators for base record while reducer is working.\nMore info can be read here: https://github.com/NatLibFi/marc-record-js\n\n### sourceValidators (Defaults {subfieldValues: false})\n```\n{tagPattern: /010/u, sourceValidators: {fields: true, subfields: true, subfieldValues: true}}\n```\n\nMarc record validators for source record while reducer is working.\nMore info can be read here: https://github.com/NatLibFi/marc-record-js\n\n## License and copyright\n\nCopyright (c) 2020-2025 **University Of Helsinki (The National Library Of Finland)**\n\nThis project's source code is licensed under the terms of **MIT** or any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlibfi%2Fmarc-record-merge-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatlibfi%2Fmarc-record-merge-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlibfi%2Fmarc-record-merge-js/lists"}