@natlibfi/marc-record-validators-melinda 9.0.6 → 9.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CODEOWNERS +10 -0
- package/.github/dependabot.yml +40 -0
- package/.github/workflows/melinda-node-tests.yml +61 -0
- package/LICENSE.txt +21 -165
- package/README.md +1 -1
- package/dist/access-rights.js +0 -27
- package/dist/access-rights.js.map +1 -1
- package/dist/access-rights.spec.js +0 -27
- package/dist/access-rights.spec.js.map +1 -1
- package/dist/double-commas.js +0 -27
- package/dist/double-commas.js.map +1 -1
- package/dist/double-commas.spec.js +0 -27
- package/dist/double-commas.spec.js.map +1 -1
- package/dist/duplicates-ind1.js +0 -27
- package/dist/duplicates-ind1.js.map +1 -1
- package/dist/duplicates-ind1.spec.js +0 -27
- package/dist/duplicates-ind1.spec.js.map +1 -1
- package/dist/empty-fields.js +0 -28
- package/dist/empty-fields.js.map +1 -1
- package/dist/empty-fields.spec.js +0 -27
- package/dist/empty-fields.spec.js.map +1 -1
- package/dist/ending-punctuation-conf.js +0 -28
- package/dist/ending-punctuation-conf.js.map +1 -1
- package/dist/ending-punctuation.js.map +1 -1
- package/dist/ending-punctuation.spec.js +0 -27
- package/dist/ending-punctuation.spec.js.map +1 -1
- package/dist/field-exclusion.js +0 -28
- package/dist/field-exclusion.js.map +1 -1
- package/dist/field-exclusion.spec.js +0 -27
- package/dist/field-exclusion.spec.js.map +1 -1
- package/dist/field-structure.js +0 -28
- package/dist/field-structure.js.map +1 -1
- package/dist/field-structure.spec.js +0 -27
- package/dist/field-structure.spec.js.map +1 -1
- package/dist/fields-present.js +0 -27
- package/dist/fields-present.js.map +1 -1
- package/dist/fields-present.spec.js +0 -27
- package/dist/fields-present.spec.js.map +1 -1
- package/dist/fixed-fields.js +0 -27
- package/dist/fixed-fields.js.map +1 -1
- package/dist/fixed-fields.spec.js +0 -27
- package/dist/fixed-fields.spec.js.map +1 -1
- package/dist/identical-fields.js +0 -28
- package/dist/identical-fields.js.map +1 -1
- package/dist/identical-fields.spec.js +0 -27
- package/dist/identical-fields.spec.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isbn-issn.js +0 -27
- package/dist/isbn-issn.js.map +1 -1
- package/dist/isbn-issn.spec.js +0 -27
- package/dist/isbn-issn.spec.js.map +1 -1
- package/dist/item-language.js +0 -27
- package/dist/item-language.js.map +1 -1
- package/dist/item-language.spec.js +0 -27
- package/dist/item-language.spec.js.map +1 -1
- package/dist/punctuation/index.js +21 -1
- package/dist/punctuation/index.js.map +1 -1
- package/dist/punctuation/rules/aut.js.map +1 -1
- package/dist/punctuation/rules/bib.js +8 -1
- package/dist/punctuation/rules/bib.js.map +1 -1
- package/dist/punctuation/rules/index.js.map +1 -1
- package/dist/punctuation.spec.js +49 -140
- package/dist/punctuation.spec.js.map +1 -1
- package/dist/resolvable-ext-references-melinda.js +0 -27
- package/dist/resolvable-ext-references-melinda.js.map +1 -1
- package/dist/resolvable-ext-references-melinda.spec.js +3 -29
- package/dist/resolvable-ext-references-melinda.spec.js.map +1 -1
- package/dist/sort-tags.js +0 -27
- package/dist/sort-tags.js.map +1 -1
- package/dist/sort-tags.spec.js +0 -27
- package/dist/sort-tags.spec.js.map +1 -1
- package/dist/subfield-exclusion.js +0 -28
- package/dist/subfield-exclusion.js.map +1 -1
- package/dist/subfield-exclusion.spec.js +0 -27
- package/dist/subfield-exclusion.spec.js.map +1 -1
- package/dist/unicode-decomposition.js +0 -28
- package/dist/unicode-decomposition.js.map +1 -1
- package/dist/unicode-decomposition.spec.js +0 -27
- package/dist/unicode-decomposition.spec.js.map +1 -1
- package/dist/urn.js +0 -27
- package/dist/urn.js.map +1 -1
- package/dist/urn.spec.js +0 -27
- package/dist/urn.spec.js.map +1 -1
- package/package.json +5 -3
- package/src/access-rights.js +0 -29
- package/src/access-rights.spec.js +0 -29
- package/src/double-commas.js +0 -29
- package/src/double-commas.spec.js +0 -29
- package/src/duplicates-ind1.js +0 -29
- package/src/duplicates-ind1.spec.js +0 -29
- package/src/empty-fields.js +0 -28
- package/src/empty-fields.spec.js +0 -29
- package/src/ending-punctuation-conf.js +0 -29
- package/src/ending-punctuation.spec.js +0 -29
- package/src/field-exclusion.js +0 -29
- package/src/field-exclusion.spec.js +0 -29
- package/src/field-structure.js +0 -29
- package/src/field-structure.spec.js +0 -29
- package/src/fields-present.js +0 -29
- package/src/fields-present.spec.js +0 -29
- package/src/fixed-fields.js +0 -29
- package/src/fixed-fields.spec.js +0 -29
- package/src/identical-fields.js +0 -28
- package/src/identical-fields.spec.js +0 -29
- package/src/index.js +0 -29
- package/src/isbn-issn.js +0 -28
- package/src/isbn-issn.spec.js +0 -29
- package/src/item-language.js +0 -29
- package/src/item-language.spec.js +0 -29
- package/src/punctuation/index.js +19 -1
- package/src/punctuation/rules/bib.js +9 -1
- package/src/punctuation.spec.js +48 -147
- package/src/resolvable-ext-references-melinda.js +0 -28
- package/src/resolvable-ext-references-melinda.spec.js +2 -30
- package/src/sort-tags.js +0 -29
- package/src/sort-tags.spec.js +0 -29
- package/src/subfield-exclusion.js +0 -29
- package/src/subfield-exclusion.spec.js +0 -29
- package/src/unicode-decomposition.js +0 -28
- package/src/unicode-decomposition.spec.js +0 -29
- package/src/urn.js +0 -29
- package/src/urn.spec.js +0 -29
- package/test-fixtures/punctuation/01/expectedResult.json +3 -0
- package/test-fixtures/punctuation/01/metadata.json +4 -0
- package/test-fixtures/punctuation/01/record.json +18 -0
- package/test-fixtures/punctuation/02/expectedResult.json +3 -0
- package/test-fixtures/punctuation/02/metadata.json +4 -0
- package/test-fixtures/punctuation/02/record.json +18 -0
- package/test-fixtures/punctuation/03/expectedResult.json +21 -0
- package/test-fixtures/punctuation/03/metadata.json +5 -0
- package/test-fixtures/punctuation/03/record.json +19 -0
- package/test-fixtures/punctuation/04/expectedResult.json +21 -0
- package/test-fixtures/punctuation/04/metadata.json +5 -0
- package/test-fixtures/punctuation/04/record.json +19 -0
- package/test-fixtures/punctuation/05/expectedResult.json +44 -0
- package/test-fixtures/punctuation/05/metadata.json +5 -0
- package/test-fixtures/punctuation/05/record.json +42 -0
- package/test-fixtures/resolvable-ext-references-melinda.js +0 -27
- package/.drone.yml +0 -93
|
@@ -4,34 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
11
|
-
*
|
|
12
|
-
* Melinda-related validators for @natlibfi/marc-record-validate
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) 2014-2017 University Of Helsinki (The National Library Of Finland)
|
|
15
|
-
*
|
|
16
|
-
* This file is part of marc-record-validators-melinda
|
|
17
|
-
*
|
|
18
|
-
* marc-record-validators-melinda is free software: you can redistribute it and/or modify
|
|
19
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
20
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
21
|
-
* License, or (at your option) any later version.
|
|
22
|
-
*
|
|
23
|
-
* This program is distributed in the hope that it will be useful,
|
|
24
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
26
|
-
* GNU Lesser General Public License for more details.
|
|
27
|
-
*
|
|
28
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
29
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30
|
-
*
|
|
31
|
-
* @licend The above is the entire license notice
|
|
32
|
-
* for the JavaScript code in this file.
|
|
33
|
-
*
|
|
34
|
-
**/
|
|
35
7
|
const MAP_CONVERSION = {
|
|
36
8
|
/**
|
|
37
9
|
* @internal Normalizations
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"unicode-decomposition.js","names":["MAP_CONVERSION","å","ä","ö","Å","Ä","Ö","á","à","â","ã","ć","č","ç","é","è","ê","ẽ","ë","í","ì","î","ĩ","ï","ñ","ó","ò","ô","õ","ś","š","ú","ù","û","ü","ũ","ý","ỳ","ŷ","ỹ","ÿ","ž","Á","À","Â","Ã","É","È","Ê","Ẽ","Ë","Í","Ì","Î","Ĩ","Ï","Ñ","Ó","Ò","Ô","Õ","Ś","Ú","Ù","Û","Ũ","Ü","Ý","Ỳ","Ŷ","Ỹ","Ÿ","PATTERN","Object","keys","reduce","result","key","index","list","length","RegExp","description","validate","fix","record","codes","getFields","fields","map","field","subfields","filter","subfield","test","value","code","valid","messages","join","forEach","convert","some","includes","replace"],"sources":["../src/unicode-decomposition.js"],"sourcesContent":["const MAP_CONVERSION = {\n\n /**\n * @internal Normalizations\n **/\n '‐': '-',\n '‑': '-',\n '‒': '-',\n '–': '-',\n '—': '-',\n '―': '-',\n\n /**\n * @internal Normalizations (MELINDA-4172, MELINDA-4175)\n **/\n 'Ⓒ': '©',\n 'Ⓟ': '℗',\n\n /**\n * @internal Precompose å, ä, ö, Å, Ä and Ö\n **/\n å: 'å',\n ä: 'ä',\n ö: 'ö',\n Å: 'Å',\n Ä: 'Ä',\n Ö: 'Ö',\n\n /**\n * @internal Decompose everything else (list incomplete)\n **/\n á: 'á',\n à: 'à',\n â: 'â',\n ã: 'ã',\n ć: 'ć',\n č: 'č',\n ç: 'ç',\n é: 'é',\n è: 'è',\n ê: 'ê',\n ẽ: 'ẽ',\n ë: 'ë',\n í: 'í',\n ì: 'ì',\n î: 'î',\n ĩ: 'ĩ',\n ï: 'ï',\n ñ: 'ñ',\n ó: 'ó',\n ò: 'ò',\n ô: 'ô',\n õ: 'õ',\n ś: 'ś',\n š: 'š',\n ú: 'ú',\n ù: 'ù',\n û: 'û',\n ü: 'ü',\n ũ: 'ũ',\n ý: 'ý',\n ỳ: 'ỳ',\n ŷ: 'ŷ',\n ỹ: 'ỹ',\n ÿ: 'ÿ',\n ž: 'ž',\n Á: 'Á',\n À: 'À',\n Â: 'Â',\n Ã: 'Ã',\n É: 'É',\n È: 'È',\n Ê: 'Ê',\n Ẽ: 'Ẽ',\n Ë: 'Ë',\n Í: 'Í',\n Ì: 'Ì',\n Î: 'Î',\n Ĩ: 'Ĩ',\n Ï: 'Ï',\n Ñ: 'Ñ',\n Ó: 'Ó',\n Ò: 'Ò',\n Ô: 'Ô',\n Õ: 'Õ',\n Ś: 'Ś',\n Ú: 'Ú',\n Ù: 'Ù',\n Û: 'Û',\n Ũ: 'Ũ',\n Ü: 'Ü',\n Ý: 'Ý',\n Ỳ: 'Ỳ',\n Ŷ: 'Ŷ',\n Ỹ: 'Ỹ',\n Ÿ: 'Ÿ'\n};\n\nexport default function () {\n const PATTERN = Object.keys(MAP_CONVERSION).reduce((result, key, index, list) => index === list.length - 1 ? new RegExp(`${result}${key})`, 'u') : `${result}${key}|`, '(');\n\n return {\n description: 'Unicode decomposer',\n validate,\n fix\n };\n\n function validate(record) {\n const codes = getFields(record.fields).map(field => {\n if ('subfields' in field) {\n return field.subfields.filter(subfield => PATTERN.test(subfield.value))\n .map(subfield => subfield.code);\n }\n\n return null;\n });\n return codes.length < 1 ? {valid: true, messages: []} : {valid: false, messages: [`The following subfields are not properly decomposed: ${codes.join(', ')}`]};\n }\n\n function fix(record) {\n getFields(record.fields).forEach(field => {\n field.subfields\n .filter(subfield => PATTERN.test(subfield.value))\n .forEach(subfield => {\n subfield.value = convert(subfield.value); // eslint-disable-line functional/immutable-data\n });\n });\n }\n\n function getFields(fields) {\n return fields.filter(field => {\n if ('subfields' in field) {\n return field.subfields.some(subfield => PATTERN.test(subfield.value));\n }\n\n return null;\n });\n }\n\n function convert(value) {\n return Object.keys(MAP_CONVERSION).reduce((result, key) => result.includes(key) ? result.replace(new RegExp(key, 'ug'), MAP_CONVERSION[key]) : result, value);\n }\n}\n"],"mappings":";;;;;;AAAA,MAAMA,cAAc,GAAG;EAErB;AACF;AACA;EACE,KAAK,GALgB;EAMrB,KAAK,GANgB;EAOrB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CAJH;IAKD,CAND;EAOD;;EAED,SAASR,SAAT,CAAmBC,MAAnB,EAA2B;IACzB,OAAOA,MAAM,CAACI,MAAP,CAAcF,KAAK,IAAI;MAC5B,IAAI,eAAeA,KAAnB,EAA0B;QACxB,OAAOA,KAAK,CAACC,SAAN,CAAgBW,IAAhB,CAAqBT,QAAQ,IAAIrB,OAAO,CAACsB,IAAR,CAAaD,QAAQ,CAACE,KAAtB,CAAjC,CAAP;MACD;;MAED,OAAO,IAAP;IACD,CANM,CAAP;EAOD;;EAED,SAASM,OAAT,CAAiBN,KAAjB,EAAwB;IACtB,OAAOtB,MAAM,CAACC,IAAP,CAAY1E,cAAZ,EAA4B2E,MAA5B,CAAmC,CAACC,MAAD,EAASC,GAAT,KAAiBD,MAAM,CAAC2B,QAAP,CAAgB1B,GAAhB,IAAuBD,MAAM,CAAC4B,OAAP,CAAe,IAAIvB,MAAJ,CAAWJ,GAAX,EAAgB,IAAhB,CAAf,EAAsC7E,cAAc,CAAC6E,GAAD,CAApD,CAAvB,GAAoFD,MAAxI,EAAgJmB,KAAhJ,CAAP;EACD;AACF"}
|
|
@@ -10,33 +10,6 @@ var _unicodeDecomposition = _interopRequireDefault(require("../src/unicode-decom
|
|
|
10
10
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
16
|
-
*
|
|
17
|
-
* MARC record validators used in Melinda
|
|
18
|
-
*
|
|
19
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
20
|
-
*
|
|
21
|
-
* This file is part of marc-record-validators-melinda
|
|
22
|
-
*
|
|
23
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
24
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
25
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
26
|
-
* License, or (at your option) any later version.
|
|
27
|
-
*
|
|
28
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
29
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
30
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
31
|
-
* GNU Lesser General Public License for more details.
|
|
32
|
-
*
|
|
33
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
34
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
-
*
|
|
36
|
-
* @licend The above is the entire license notice
|
|
37
|
-
* for the JavaScript code in this file.
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
13
|
const {
|
|
41
14
|
expect
|
|
42
15
|
} = _chai.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"unicode-decomposition.spec.js","names":["expect","chai","use","chaiAsPromised","describe","it","validator","to","be","an","that","has","any","keys","description","a","validate","record","MarcRecord","fields","tag","subfields","code","value","result","eql","valid","messages","ind1","ind2","recordOriginal","toObject","fieldModified","fix","not"],"sources":["../src/unicode-decomposition.spec.js"],"sourcesContent":["import chai from 'chai';\nimport chaiAsPromised from 'chai-as-promised';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from '../src/unicode-decomposition';\n\nconst {expect} = chai;\nchai.use(chaiAsPromised);\n\ndescribe('unicode-decomposition', () => {\n it('Creates a validator', async () => {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n });\n\n describe('#validate', () => {\n it('Finds the record valid', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [\n {\n tag: '245',\n subfields: [\n {\n code: 'a',\n value: 'Föö, Bär'\n }\n ]\n }\n ]\n });\n const result = await validator.validate(record);\n expect(result).to.eql({valid: true, messages: []});\n });\n\n it('Finds the record invalid', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [\n {\n tag: '001',\n ind1: ' ',\n ind2: '0',\n subfields: [\n {\n code: 'a',\n value: 'Föö, Bär'\n }\n ]\n }\n ]\n });\n const result = await validator.validate(record);\n\n expect(result).to.eql({valid: false, messages: ['The following subfields are not properly decomposed: a']});\n });\n\n describe('#fix', () => {\n it('Should fix the record', async () => {\n const validator = await validatorFactory();\n\n const record = new MarcRecord({\n fields: [\n {\n tag: '245',\n subfields: [\n {\n code: 'a',\n value: 'Föö, Bär'\n },\n {\n code: 'b',\n value: '== Fubar'\n }\n ]\n }\n ]\n });\n\n const recordOriginal = record.toObject();\n const fieldModified = {\n tag: '245',\n ind1: ' ',\n ind2: ' ',\n subfields: [\n {\n code: 'a',\n value: 'Föö, Bär'\n },\n {\n code: 'b',\n value: '== Fubar'\n }\n ]\n };\n await validator.fix(record);\n\n expect(recordOriginal).to.not.eql(record);\n expect(record.fields).to.eql([fieldModified]);\n });\n });\n });\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;;;AAEA,MAAM;EAACA;AAAD,IAAWC,aAAjB;;AACAA,cAAKC,GAAL,CAASC,uBAAT;;AAEAC,QAAQ,CAAC,uBAAD,EAA0B,MAAM;EACtCC,EAAE,CAAC,qBAAD,EAAwB,YAAY;IACpC,MAAMC,SAAS,GAAG,MAAM,oCAAxB;IAEAN,MAAM,CAACM,SAAD,CAAN,CACGC,EADH,CACMC,EADN,CACSC,EADT,CACY,QADZ,EAEGC,IAFH,CAEQC,GAFR,CAEYC,GAFZ,CAEgBC,IAFhB,CAEqB,aAFrB,EAEoC,UAFpC;IAIAb,MAAM,CAACM,SAAS,CAACQ,WAAX,CAAN,CAA8BP,EAA9B,CAAiCC,EAAjC,CAAoCO,CAApC,CAAsC,QAAtC;IACAf,MAAM,CAACM,SAAS,CAACU,QAAX,CAAN,CAA2BT,EAA3B,CAA8BC,EAA9B,CAAiCO,CAAjC,CAAmC,UAAnC;EACD,CATC,CAAF;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AAMW,MAAM,GAAG,IAAIC,sBAAJ,CAAe;UAC5BC,MAAM,EAAE,CACN;YACEC,GAAG,EAAE,KADP;YAEEC,SAAS,EAAE,CACT;cACEC,IAAI,EAAE,GADR;cAEEC,KAAK,EAAE;YAFT,CADS,EAKT;cACED,IAAI,EAAE,GADR;cAEEC,KAAK,EAAE;YAFT,CALS;UAFb,CADM;QADoB,CAAf,CAAf;QAkBA,MAAMO,cAAc,GAAGb,MAAM,CAACc,QAAP,EAAvB;QACA,MAAMC,aAAa,GAAG;UACpBZ,GAAG,EAAE,KADe;UAEpBQ,IAAI,EAAE,GAFc;UAGpBC,IAAI,EAAE,GAHc;UAIpBR,SAAS,EAAE,CACT;YACEC,IAAI,EAAE,GADR;YAEEC,KAAK,EAAE;UAFT,CADS,EAKT;YACED,IAAI,EAAE,GADR;YAEEC,KAAK,EAAE;UAFT,CALS;QAJS,CAAtB;QAeA,MAAMjB,SAAS,CAAC2B,GAAV,CAAchB,MAAd,CAAN;QAEAjB,MAAM,CAAC8B,cAAD,CAAN,CAAuBvB,EAAvB,CAA0B2B,GAA1B,CAA8BT,GAA9B,CAAkCR,MAAlC;QACAjB,MAAM,CAACiB,MAAM,CAACE,MAAR,CAAN,CAAsBZ,EAAtB,CAAyBkB,GAAzB,CAA6B,CAACO,aAAD,CAA7B;MACD,CAzCC,CAAF;IA0CD,CA3CO,CAAR;EA4CD,CAtFO,CAAR;AAuFD,CAnGO,CAAR"}
|
package/dist/urn.js
CHANGED
|
@@ -9,33 +9,6 @@ var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
15
|
-
*
|
|
16
|
-
* MARC record validators used in Melinda
|
|
17
|
-
*
|
|
18
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
19
|
-
*
|
|
20
|
-
* This file is part of marc-record-validators-melinda
|
|
21
|
-
*
|
|
22
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
23
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
24
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
25
|
-
* License, or (at your option) any later version.
|
|
26
|
-
*
|
|
27
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
28
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
29
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
30
|
-
* GNU Lesser General Public License for more details.
|
|
31
|
-
*
|
|
32
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
33
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
34
|
-
*
|
|
35
|
-
* @licend The above is the entire license notice
|
|
36
|
-
* for the JavaScript code in this file.
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
12
|
const URN_GENERATOR_URL = 'http://generator.urn.fi/cgi-bin/urn_generator.cgi?type=nbn';
|
|
40
13
|
|
|
41
14
|
function _default(isLegalDeposit = false) {
|
package/dist/urn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"urn.js","names":["URN_GENERATOR_URL","isLegalDeposit","hasURN","f","tag","subfields","some","code","value","test","description","validate","fix","record","f856sUrn","fields","filter","ldSubfields","createLDSubfields","length","insertField","ind1","ind2","createURNSubfield","forEach","ldsf","sf","push","rec","isbn","reduce","acc","a","find","undefined","createURN","response","body","text","valid"],"sources":["../src/urn.js"],"sourcesContent":["import fetch from 'node-fetch';\n\nconst URN_GENERATOR_URL = 'http://generator.urn.fi/cgi-bin/urn_generator.cgi?type=nbn';\n\nexport default function (isLegalDeposit = false) {\n const hasURN = f => f.tag === '856' && f.subfields.some(({code, value}) => code === 'u' && (/urn.fi/u).test(value));\n\n return {\n description: 'Adds URN for record, to 856-field (if not existing)',\n validate,\n fix\n };\n\n async function fix(record) {\n const f856sUrn = record.fields.filter(hasURN);\n const ldSubfields = isLegalDeposit ? createLDSubfields() : [];\n\n if (f856sUrn.length === 0) { // eslint-disable-line functional/no-conditional-statement\n record.insertField({\n tag: '856',\n ind1: '4',\n ind2: '0',\n subfields: [await createURNSubfield(record), ...ldSubfields]\n });\n } else if (isLegalDeposit) { // eslint-disable-line functional/no-conditional-statement\n f856sUrn.forEach(f => {\n ldSubfields.forEach(ldsf => {\n if (!f.subfields.some(sf => sf.code === ldsf.code && sf.value === ldsf.value)) { // eslint-disable-line functional/no-conditional-statement\n f.subfields.push(ldsf); // eslint-disable-line functional/immutable-data\n }\n });\n });\n }\n\n return true;\n\n async function createURNSubfield(rec) {\n const isbn = rec.fields.reduce((acc, f) => {\n if (f.tag === '020') {\n const a = f.subfields.find(sf => sf.code === 'a');\n return a ? a.value : undefined;\n }\n\n return acc;\n }, undefined);\n\n return {\n code: 'u',\n value: await createURN(isbn)\n };\n\n async function createURN(isbn = false) {\n if (isbn) {\n return `http://urn.fi/URN:ISBN:${isbn}`;\n }\n\n const response = await fetch(URN_GENERATOR_URL);\n const body = await response.text();\n return `http://urn.fi/${body}`;\n }\n }\n\n function createLDSubfields() {\n return [\n {\n code: 'z',\n value: 'Käytettävissä vapaakappalekirjastoissa'\n },\n {\n code: '5',\n value: 'FI-Vapaa'\n }\n ];\n }\n }\n\n function validate(record) {\n return {valid: record.fields.some(hasURN) && !isLegalDeposit};\n }\n}\n"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,iBAAiB,GAAG,4DAA1B;;AAEe,kBAAUC,cAAc,GAAG,KAA3B,EAAkC;EAC/C,MAAMC,MAAM,GAAGC,CAAC,IAAIA,CAAC,CAACC,GAAF,KAAU,KAAV,IAAmBD,CAAC,CAACE,SAAF,CAAYC,IAAZ,CAAiB,CAAC;IAACC,IAAD;IAAOC;EAAP,CAAD,KAAmBD,I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,CAAC,CAACC,GAAF,KAAU,KAAd,EAAqB;UACnB,MAAM4B,CAAC,GAAG7B,CAAC,CAACE,SAAF,CAAY4B,IAAZ,CAAiBP,EAAE,IAAIA,EAAE,CAACnB,IAAH,KAAY,GAAnC,CAAV;UACA,OAAOyB,CAAC,GAAGA,CAAC,CAACxB,KAAL,GAAa0B,SAArB;QACD;;QAED,OAAOH,GAAP;MACD,CAPY,EAOVG,SAPU,CAAb;MASA,OAAO;QACL3B,IAAI,EAAE,GADD;QAELC,KAAK,EAAE,MAAM2B,SAAS,CAACN,IAAD;MAFjB,CAAP;;MAKA,eAAeM,SAAf,CAAyBN,IAAI,GAAG,KAAhC,EAAuC;QACrC,IAAIA,IAAJ,EAAU;UACR,OAAQ,0BAAyBA,IAAK,EAAtC;QACD;;QAED,MAAMO,QAAQ,GAAG,MAAM,wBAAMpC,iBAAN,CAAvB;QACA,MAAMqC,IAAI,GAAG,MAAMD,QAAQ,CAACE,IAAT,EAAnB;QACA,OAAQ,iBAAgBD,IAAK,EAA7B;MACD;IACF;;IAED,SAASnB,iBAAT,GAA6B;MAC3B,OAAO,CACL;QACEX,IAAI,EAAE,GADR;QAEEC,KAAK,EAAE;MAFT,CADK,EAKL;QACED,IAAI,EAAE,GADR;QAEEC,KAAK,EAAE;MAFT,CALK,CAAP;IAUD;EACF;;EAED,SAASG,QAAT,CAAkBE,MAAlB,EAA0B;IACxB,OAAO;MAAC0B,KAAK,EAAE1B,MAAM,CAACE,MAAP,CAAcT,IAAd,CAAmBJ,MAAnB,KAA8B,CAACD;IAAvC,CAAP;EACD;AACF"}
|
package/dist/urn.spec.js
CHANGED
|
@@ -8,33 +8,6 @@ var _urn = _interopRequireDefault(require("../src/urn"));
|
|
|
8
8
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
14
|
-
*
|
|
15
|
-
* MARC record validators used in Melinda
|
|
16
|
-
*
|
|
17
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
18
|
-
*
|
|
19
|
-
* This file is part of marc-record-validators-melinda
|
|
20
|
-
*
|
|
21
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
22
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
23
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
24
|
-
* License, or (at your option) any later version.
|
|
25
|
-
*
|
|
26
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
27
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
-
* GNU Lesser General Public License for more details.
|
|
30
|
-
*
|
|
31
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
32
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
33
|
-
*
|
|
34
|
-
* @licend The above is the entire license notice
|
|
35
|
-
* for the JavaScript code in this file.
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
11
|
describe('urn', async () => {
|
|
39
12
|
// Fields
|
|
40
13
|
const ldf856 = {
|
package/dist/urn.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"urn.spec.js","names":["describe","ldf856","tag","ind1","ind2","subfields","code","value","f856URN","f856URL","f020","it","validator","to","be","an","that","has","any","keys","description","a","validate","test","isLegalDeposit","valid","recfields","result","MarcRecord","fields","eql","fix","resfields","record","nonld","ld"],"sources":["../src/urn.spec.js"],"sourcesContent":["import {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from '../src/urn';\n\ndescribe('urn', async () => {\n // Fields\n const ldf856 = {\n tag: '856',\n ind1: '4',\n ind2: '0',\n subfields: [\n {code: 'u', value: 'http://urn.fi/URN:ISBN:978-951-9155-47-0'},\n {code: 'z', value: 'Käytettävissä vapaakappalekirjastoissa'},\n {code: '5', value: 'FI-Vapaa'}\n ]\n };\n const f856URN = {\n tag: '856',\n ind1: '4',\n ind2: '0',\n subfields: [{code: 'u', value: 'http://urn.fi/URN:ISBN:978-951-9155-47-0'}]\n };\n const f856URL = {\n tag: '856',\n ind1: '4',\n ind2: '0',\n subfields: [{code: 'u', value: 'http://foo.bar/'}]\n };\n const f020 = {\n tag: '020',\n ind1: ' ',\n ind2: ' ',\n subfields: [{code: 'a', value: '978-951-9155-47-0'}]\n };\n\n it('Creates a validator', async () => {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n });\n\n // Tests\n const test = async isLegalDeposit => {\n const validator = await validatorFactory(isLegalDeposit);\n return {\n validate: async (valid, ...recfields) => {\n const result = await validator.validate(new MarcRecord({fields: recfields}));\n expect(result).to.eql({valid});\n },\n\n fix: async (recfields, resfields) => {\n const record = new MarcRecord({fields: recfields});\n await validator.fix(record);\n expect(record.fields).to.eql(resfields);\n }\n };\n };\n\n /// Non-legal and legal deposit\n const nonld = await test(false);\n const ld = await test(true);\n\n describe('#validate', () => {\n // Validate non-legal deposit\n it('Finds the record valid; 856 with urn, and is non-legal deposit', async () => {\n await nonld.validate(true, f856URN);\n });\n\n it('Finds the record invalid; 856 without urn, and is non-legal deposit', async () => {\n await nonld.validate(false, f856URL);\n });\n\n it('Finds the record invalid; Missing 856, and is non-legal deposit', async () => {\n await nonld.validate(false, f020);\n });\n\n // Validate legal deposit\n it('Finds the record invalid; 856 with urn, and is legal deposit', async () => {\n await ld.validate(false, f020, f856URN);\n });\n\n it('Finds the record invalid; 856 without urn, and is legal deposit', async () => {\n await ld.validate(false, f020, f856URL);\n });\n\n it('Finds the record invalid; Missing 856, and is legal deposit', async () => {\n await ld.validate(false, f020);\n });\n });\n\n describe('#fix', () => {\n // Validate non-legal deposit\n it('856 with urn, and is non-legal deposit; Nothing to add', async () => {\n await nonld.fix([f020, f856URL, f856URN], [f020, f856URL, f856URN]);\n });\n\n it('856 without urn, and is non-legal deposit; Adds 856 with urn', async () => {\n await nonld.fix([f020, f856URL], [f020, f856URL, f856URN]);\n });\n\n it('Missing 856, and is non-legal deposit; Adds 856 with urn', async () => {\n await nonld.fix([f020], [f020, f856URN]);\n });\n\n // Validate legal deposit\n it('856 with urn and legal deposit fields, and is legal deposit; Nothing to add', async () => {\n await ld.fix([f020, f856URL, ldf856], [f020, f856URL, ldf856]);\n });\n\n it('856 without urn, and is legal deposit; Adds 856 with urn and legal deposit fields', async () => {\n await ld.fix([f020, f856URL], [f020, f856URL, ldf856]);\n });\n\n it('Missing 856, and is legal deposit; Adds 856 with urn and legal deposit fields', async () => {\n await ld.fix([f020], [f020, ldf856]);\n });\n\n it('856 with urn, and is legal deposit; Adds legal deposit fields', async () => {\n await ld.fix([f020, f856URL, f856URN], [f020, f856URL, ldf856]);\n });\n });\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEAA,QAAQ,CAAC,KAAD,EAAQ,YAAY;EAC1B;EACA,MAAMC,MAAM,GAAG;IACbC,GAAG,EAAE,KADQ;IAEbC,IAAI,EAAE,GAFO;IAGbC,IAAI,EAAE,GAHO;IAIbC,SAAS,EAAE,CACT;MAACC,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CADS,EAET;MAACD,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CAFS,EAGT;MAACD,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CAHS;EAJE,CAAf;EAUA,MAAMC,OAAO,GAAG;IACdN,GAAG,EAAE,KADS;IAEdC,IAAI,EAAE,GAFQ;IAGdC,IAAI,EAAE,GAHQ;IAIdC,SAAS,EAAE,CAAC;MAACC,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CAAD;EAJG,C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AAE,CAAC,+DAAD,EAAkE,YAAY;MAC9E,MAAMwB,EAAE,CAACJ,GAAH,CAAO,CAACrB,IAAD,EAAOD,OAAP,EAAgBD,OAAhB,CAAP,EAAiC,CAACE,IAAD,EAAOD,OAAP,EAAgBR,MAAhB,CAAjC,CAAN;IACD,CAFC,CAAF;EAGD,CA9BO,CAAR;AA+BD,CA1HO,CAAR"}
|
package/package.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "git@github.com:natlibfi/marc-record-validators-melinda.git"
|
|
15
15
|
},
|
|
16
|
-
"license": "
|
|
17
|
-
"version": "9.0.
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"version": "9.0.7",
|
|
18
18
|
"main": "./dist/index.js",
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
@@ -50,9 +50,11 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@babel/cli": "^7.16.8",
|
|
52
52
|
"@babel/core": "^7.16.12",
|
|
53
|
-
"@babel/preset-env": "^7.16.11",
|
|
54
53
|
"@babel/eslint-parser": "^7.16.5",
|
|
54
|
+
"@babel/preset-env": "^7.16.11",
|
|
55
55
|
"@natlibfi/eslint-config-melinda-backend": "^2.0.0",
|
|
56
|
+
"@natlibfi/fixugen": "^1.0.2",
|
|
57
|
+
"@natlibfi/fixura": "^2.2.1",
|
|
56
58
|
"babel-plugin-istanbul": "^6.1.1",
|
|
57
59
|
"babel-plugin-rewire": "^1.2.0",
|
|
58
60
|
"chai": "^4.3.6",
|
package/src/access-rights.js
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
export default function () {
|
|
31
2
|
const sf506 = [{code: 'a', value: /aineisto on käytettävissä vapaakappalekirjastoissa/ui}];
|
|
32
3
|
const sf540 = [{code: 'c', value: /laki kulttuuriaineistojen tallettamisesta ja säilyttämisestä/ui}];
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
import {expect} from 'chai';
|
|
31
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
32
3
|
import validatorFactory from '../src/access-rights';
|
package/src/double-commas.js
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
export default function () {
|
|
31
2
|
return {
|
|
32
3
|
description: 'Handle double commas in 700$e-subfields',
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
import {expect} from 'chai';
|
|
31
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
32
3
|
import validatorFactory from '../src/double-commas';
|
package/src/duplicates-ind1.js
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
export default function (tagPattern) {
|
|
31
2
|
if (tagPattern instanceof RegExp) {
|
|
32
3
|
return {
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
import {expect} from 'chai';
|
|
31
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
32
3
|
import validatorFactory from '../src/duplicates-ind1';
|
package/src/empty-fields.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
1
|
const ERRORS = {
|
|
30
2
|
EMPTY_SUBFIELDS: 2,
|
|
31
3
|
MISSING_SUBFIELD_VALUES: 3
|
package/src/empty-fields.spec.js
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
import {expect} from 'chai';
|
|
31
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
32
3
|
import validatorFactory from '../src/empty-fields';
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* MARC record validators used in Melinda
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
|
|
8
|
-
*
|
|
9
|
-
* This file is part of marc-record-validators-melinda
|
|
10
|
-
*
|
|
11
|
-
* marc-record-validators-melinda program is free software: you can redistribute it and/or modify
|
|
12
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
13
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
14
|
-
* License, or (at your option) any later version.
|
|
15
|
-
*
|
|
16
|
-
* marc-record-validators-melinda is distributed in the hope that it will be useful,
|
|
17
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
-
* GNU Lesser General Public License for more details.
|
|
20
|
-
*
|
|
21
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
22
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
*
|
|
24
|
-
* @licend The above is the entire license notice
|
|
25
|
-
* for the JavaScript code in this file.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
1
|
// Const finnishTerms = ['ysa', 'yso', 'kassu', 'seko', 'valo', 'kulo', 'puho', 'oiko', 'mero', 'liito', 'fast', 'allars', 'kaunokki'];
|
|
31
2
|
const finnishTerms = [
|
|
32
3
|
/^ysa$/u,
|