@natlibfi/marc-record-validators-melinda 11.6.6 → 11.6.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/workflows/melinda-node-tests.yml +1 -1
- package/dist/access-rights.js +1 -5
- package/dist/access-rights.js.map +1 -1
- package/dist/addMissingField336.js +1 -1
- package/dist/addMissingField336.js.map +1 -1
- package/dist/cyrillux-usemarcon-replacement.js +41 -45
- package/dist/cyrillux-usemarcon-replacement.js.map +1 -1
- package/dist/cyrillux.js +13 -17
- package/dist/cyrillux.js.map +1 -1
- package/dist/disambiguateSeriesStatements.js +3 -4
- package/dist/disambiguateSeriesStatements.js.map +1 -1
- package/dist/double-commas.js +2 -1
- package/dist/double-commas.js.map +1 -1
- package/dist/duplicates-ind1.js +1 -1
- package/dist/duplicates-ind1.js.map +1 -1
- package/dist/empty-fields.js +0 -4
- package/dist/empty-fields.js.map +1 -1
- package/dist/ending-punctuation.js +21 -49
- package/dist/ending-punctuation.js.map +1 -1
- package/dist/ending-whitespace.js +0 -4
- package/dist/ending-whitespace.js.map +1 -1
- package/dist/field-008-18-34-character-groups.js +4 -5
- package/dist/field-008-18-34-character-groups.js.map +1 -1
- package/dist/field-505-separators.js +8 -6
- package/dist/field-505-separators.js.map +1 -1
- package/dist/field-521-fix.js +5 -6
- package/dist/field-521-fix.js.map +1 -1
- package/dist/field-exclusion.js +5 -12
- package/dist/field-exclusion.js.map +1 -1
- package/dist/field-exclusion.spec.js +3 -5
- package/dist/field-exclusion.spec.js.map +1 -1
- package/dist/field-structure.js +2 -5
- package/dist/field-structure.js.map +1 -1
- package/dist/fields-present.js +1 -1
- package/dist/fields-present.js.map +1 -1
- package/dist/fields-present.spec.js +1 -1
- package/dist/fields-present.spec.js.map +1 -1
- package/dist/fix-33X.js +5 -6
- package/dist/fix-33X.js.map +1 -1
- package/dist/fix-country-codes.js +3 -4
- package/dist/fix-country-codes.js.map +1 -1
- package/dist/fix-language-codes.js +12 -9
- package/dist/fix-language-codes.js.map +1 -1
- package/dist/fixRelatorTerms.js +8 -8
- package/dist/fixRelatorTerms.js.map +1 -1
- package/dist/fixed-fields.js +1 -4
- package/dist/fixed-fields.js.map +1 -1
- package/dist/identical-fields.js +2 -3
- package/dist/identical-fields.js.map +1 -1
- package/dist/indicator-fixes.js +14 -15
- package/dist/indicator-fixes.js.map +1 -1
- package/dist/isbn-issn.js +8 -11
- package/dist/isbn-issn.js.map +1 -1
- package/dist/item-language.js +5 -12
- package/dist/item-language.js.map +1 -1
- package/dist/merge-fields/counterpartField.js +6 -8
- package/dist/merge-fields/counterpartField.js.map +1 -1
- package/dist/merge-fields/index.js +3 -3
- package/dist/merge-fields/index.js.map +1 -1
- package/dist/merge-fields/mergeConstraints.js +0 -1
- package/dist/merge-fields/mergeConstraints.js.map +1 -1
- package/dist/merge-fields/mergeField.js +12 -18
- package/dist/merge-fields/mergeField.js.map +1 -1
- package/dist/merge-fields/mergeIndicator.js +5 -5
- package/dist/merge-fields/mergeIndicator.js.map +1 -1
- package/dist/merge-fields/mergeOrAddPostprocess.js +6 -9
- package/dist/merge-fields/mergeOrAddPostprocess.js.map +1 -1
- package/dist/merge-fields/mergeOrAddSubfield.js +6 -8
- package/dist/merge-fields/mergeOrAddSubfield.js.map +1 -1
- package/dist/merge-fields/mergeSubfield.js +8 -8
- package/dist/merge-fields/mergeSubfield.js.map +1 -1
- package/dist/merge-fields/removeDuplicateSubfields.js +1 -2
- package/dist/merge-fields/removeDuplicateSubfields.js.map +1 -1
- package/dist/merge-fields/worldKnowledge.js +1 -1
- package/dist/merge-fields/worldKnowledge.js.map +1 -1
- package/dist/mergeField500Lisapainokset.js +0 -3
- package/dist/mergeField500Lisapainokset.js.map +1 -1
- package/dist/mergeRelatorTermFields.js +3 -3
- package/dist/mergeRelatorTermFields.js.map +1 -1
- package/dist/modernize-502.js +6 -6
- package/dist/modernize-502.js.map +1 -1
- package/dist/multiple-subfield-0.js +4 -4
- package/dist/multiple-subfield-0.js.map +1 -1
- package/dist/non-breaking-space.js +0 -4
- package/dist/non-breaking-space.js.map +1 -1
- package/dist/normalize-dashes.js +5 -4
- package/dist/normalize-dashes.js.map +1 -1
- package/dist/normalize-identifiers.js +6 -6
- package/dist/normalize-identifiers.js.map +1 -1
- package/dist/normalize-qualifying-information.js +4 -4
- package/dist/normalize-qualifying-information.js.map +1 -1
- package/dist/normalize-utf8-diacritics.js +7 -7
- package/dist/normalize-utf8-diacritics.js.map +1 -1
- package/dist/normalizeFieldForComparison.js +21 -20
- package/dist/normalizeFieldForComparison.js.map +1 -1
- package/dist/normalizeSubfieldValueForComparison.js +1 -2
- package/dist/normalizeSubfieldValueForComparison.js.map +1 -1
- package/dist/prepublicationUtils.js +3 -3
- package/dist/prepublicationUtils.js.map +1 -1
- package/dist/punctuation/index.js +14 -31
- package/dist/punctuation/index.js.map +1 -1
- package/dist/punctuation2.js +9 -10
- package/dist/punctuation2.js.map +1 -1
- package/dist/reindexSubfield6OccurenceNumbers.js +8 -9
- package/dist/reindexSubfield6OccurenceNumbers.js.map +1 -1
- package/dist/removeDuplicateDataFields.js +18 -20
- package/dist/removeDuplicateDataFields.js.map +1 -1
- package/dist/removeInferiorDataFields.js +16 -19
- package/dist/removeInferiorDataFields.js.map +1 -1
- package/dist/resolvable-ext-references-melinda.js +4 -8
- package/dist/resolvable-ext-references-melinda.js.map +1 -1
- package/dist/resolveOrphanedSubfield6s.js +9 -9
- package/dist/resolveOrphanedSubfield6s.js.map +1 -1
- package/dist/sanitize-vocabulary-source-codes.js +9 -9
- package/dist/sanitize-vocabulary-source-codes.js.map +1 -1
- package/dist/sort-tags.js +2 -2
- package/dist/sort-tags.js.map +1 -1
- package/dist/sortFields.js +4 -9
- package/dist/sortFields.js.map +1 -1
- package/dist/sortRelatorTerms.js +4 -5
- package/dist/sortRelatorTerms.js.map +1 -1
- package/dist/sortSubfields.js +5 -6
- package/dist/sortSubfields.js.map +1 -1
- package/dist/stripPunctuation.js +2 -2
- package/dist/stripPunctuation.js.map +1 -1
- package/dist/subfield-exclusion.js +4 -11
- package/dist/subfield-exclusion.js.map +1 -1
- package/dist/subfield6Utils.js +12 -11
- package/dist/subfield6Utils.js.map +1 -1
- package/dist/subfield8Utils.js +8 -9
- package/dist/subfield8Utils.js.map +1 -1
- package/dist/subfieldValueNormalizations.js +5 -8
- package/dist/subfieldValueNormalizations.js.map +1 -1
- package/dist/sync-007-and-300.js +8 -8
- package/dist/sync-007-and-300.js.map +1 -1
- package/dist/translate-terms.js +5 -6
- package/dist/translate-terms.js.map +1 -1
- package/dist/typeOfDate-008.js +3 -4
- package/dist/typeOfDate-008.js.map +1 -1
- package/dist/unicode-decomposition.js +1 -1
- package/dist/unicode-decomposition.js.map +1 -1
- package/dist/update-field-540.js +5 -6
- package/dist/update-field-540.js.map +1 -1
- package/dist/urn.js +4 -9
- package/dist/urn.js.map +1 -1
- package/dist/utils.js +5 -9
- package/dist/utils.js.map +1 -1
- package/eslint.config.mjs +53 -0
- package/package.json +12 -13
- package/src/access-rights.js +4 -4
- package/src/addMissingField336.js +1 -1
- package/src/cyrillux-usemarcon-replacement.js +38 -38
- package/src/cyrillux.js +14 -14
- package/src/disambiguateSeriesStatements.js +3 -3
- package/src/double-commas.js +2 -2
- package/src/duplicates-ind1.js +1 -1
- package/src/empty-fields.js +4 -4
- package/src/ending-punctuation.js +46 -49
- package/src/ending-whitespace.js +0 -2
- package/src/field-008-18-34-character-groups.js +5 -5
- package/src/field-505-separators.js +6 -6
- package/src/field-521-fix.js +6 -6
- package/src/field-exclusion.js +12 -12
- package/src/field-exclusion.spec.js +4 -4
- package/src/field-structure.js +5 -5
- package/src/fields-present.js +1 -1
- package/src/fields-present.spec.js +1 -1
- package/src/fix-33X.js +5 -5
- package/src/fix-country-codes.js +3 -3
- package/src/fix-language-codes.js +10 -9
- package/src/fixRelatorTerms.js +8 -8
- package/src/fixed-fields.js +3 -3
- package/src/identical-fields.js +3 -3
- package/src/indicator-fixes.js +15 -15
- package/src/isbn-issn.js +11 -11
- package/src/item-language.js +10 -10
- package/src/merge-fields/counterpartField.js +7 -7
- package/src/merge-fields/index.js +3 -3
- package/src/merge-fields/mergeConstraints.js +1 -1
- package/src/merge-fields/mergeField.js +16 -17
- package/src/merge-fields/mergeIndicator.js +5 -5
- package/src/merge-fields/mergeOrAddPostprocess.js +9 -9
- package/src/merge-fields/mergeOrAddSubfield.js +6 -6
- package/src/merge-fields/mergeSubfield.js +8 -8
- package/src/merge-fields/removeDuplicateSubfields.js +1 -2
- package/src/merge-fields/worldKnowledge.js +1 -1
- package/src/mergeField500Lisapainokset.js +0 -2
- package/src/mergeRelatorTermFields.js +3 -3
- package/src/modernize-502.js +6 -6
- package/src/multiple-subfield-0.js +4 -4
- package/src/non-breaking-space.js +0 -2
- package/src/normalize-dashes.js +4 -4
- package/src/normalize-identifiers.js +6 -6
- package/src/normalize-qualifying-information.js +4 -4
- package/src/normalize-utf8-diacritics.js +7 -7
- package/src/normalizeFieldForComparison.js +20 -20
- package/src/normalizeSubfieldValueForComparison.js +1 -1
- package/src/prepublicationUtils.js +3 -3
- package/src/punctuation/index.js +29 -29
- package/src/punctuation2.js +10 -10
- package/src/reindexSubfield6OccurenceNumbers.js +9 -9
- package/src/removeDuplicateDataFields.js +21 -23
- package/src/removeInferiorDataFields.js +19 -19
- package/src/resolvable-ext-references-melinda.js +8 -8
- package/src/resolveOrphanedSubfield6s.js +9 -9
- package/src/sanitize-vocabulary-source-codes.js +8 -8
- package/src/sort-tags.js +2 -2
- package/src/sortFields.js +6 -6
- package/src/sortRelatorTerms.js +5 -5
- package/src/sortSubfields.js +6 -6
- package/src/stripPunctuation.js +2 -2
- package/src/subfield-exclusion.js +11 -11
- package/src/subfield6Utils.js +11 -11
- package/src/subfield8Utils.js +6 -9
- package/src/subfieldValueNormalizations.js +5 -7
- package/src/sync-007-and-300.js +8 -8
- package/src/translate-terms.js +3 -5
- package/src/typeOfDate-008.js +3 -3
- package/src/unicode-decomposition.js +1 -1
- package/src/update-field-540.js +6 -6
- package/src/urn.js +8 -6
- package/src/utils.js +8 -8
- package/.eslintignore +0 -1
package/src/cyrillux.js
CHANGED
|
@@ -24,10 +24,10 @@ export default function (config = {}) {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
function preprocessConfig() {
|
|
27
|
-
config.retainCyrillic = typeof config.retainCyrillic === 'undefined' ? true : config.retainCyrillic;
|
|
28
|
-
config.doISO9Transliteration = typeof config.doISO9Transliteration === 'undefined' ? true : config.doISO9Transliteration;
|
|
29
|
-
config.doSFS4900Transliteration = typeof config.doSFS4900Transliteration === 'undefined' ? true : config.doSFS4900Transliteration;
|
|
30
|
-
config.preferSFS4900 = setPreference();
|
|
27
|
+
config.retainCyrillic = typeof config.retainCyrillic === 'undefined' ? true : config.retainCyrillic;
|
|
28
|
+
config.doISO9Transliteration = typeof config.doISO9Transliteration === 'undefined' ? true : config.doISO9Transliteration;
|
|
29
|
+
config.doSFS4900Transliteration = typeof config.doSFS4900Transliteration === 'undefined' ? true : config.doSFS4900Transliteration;
|
|
30
|
+
config.preferSFS4900 = setPreference();
|
|
31
31
|
|
|
32
32
|
function setPreference() {
|
|
33
33
|
if (!config.doSFS4900Transliteration) {
|
|
@@ -52,9 +52,9 @@ export default function (config = {}) {
|
|
|
52
52
|
|
|
53
53
|
const nBefore = record.fields.length;
|
|
54
54
|
|
|
55
|
-
record.fields = processFields(record.fields);
|
|
55
|
+
record.fields = processFields(record.fields);
|
|
56
56
|
|
|
57
|
-
if (nBefore < record.fields.length) {
|
|
57
|
+
if (nBefore < record.fields.length) {
|
|
58
58
|
reindexSubfield6OccurenceNumbers().fix(record);
|
|
59
59
|
sortFields().fix(record);
|
|
60
60
|
}
|
|
@@ -84,7 +84,7 @@ export default function (config = {}) {
|
|
|
84
84
|
validateField(field, res, record);
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
res.valid = !(res.message.length >= 1);
|
|
87
|
+
res.valid = !(res.message.length >= 1);
|
|
88
88
|
return res;
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -92,16 +92,16 @@ export default function (config = {}) {
|
|
|
92
92
|
const orig = fieldToString(field);
|
|
93
93
|
|
|
94
94
|
const normalizedFields = processField(clone(field), record);
|
|
95
|
-
const mod = fieldsToString(normalizedFields).replace(/\t__SEPARATOR__\t/ug, ', ').replace(/ (‡6 [0-9][0-9][0-9])-[0-9][0-9]+/gu, ' $1-NN');
|
|
95
|
+
const mod = fieldsToString(normalizedFields).replace(/\t__SEPARATOR__\t/ug, ', ').replace(/ (‡6 [0-9][0-9][0-9])-[0-9][0-9]+/gu, ' $1-NN');
|
|
96
96
|
if (orig !== mod) { // Fail as the input is "broken"/"crap"/sumthing
|
|
97
|
-
res.message.push(`CHANGE: ${orig} => ${mod}`);
|
|
97
|
+
res.message.push(`CHANGE: ${orig} => ${mod}`);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function isCyrillicCharacter(char) {
|
|
104
|
-
return XRegExp('[\\p{Cyrillic}]').test(char);
|
|
104
|
+
return XRegExp('[\\p{Cyrillic}]').test(char);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
function containsCyrillicCharacters(str) { // from melinda-ui-cyrillux
|
|
@@ -192,7 +192,7 @@ export default function (config = {}) {
|
|
|
192
192
|
// Translitetation goes to field 880:
|
|
193
193
|
|
|
194
194
|
//const subfield6 = newField.subfields.find(sf => sf.code === '6');
|
|
195
|
-
newField.tag = '880';
|
|
195
|
+
newField.tag = '880';
|
|
196
196
|
resetSubfield6Tag(subfield6, field.tag);
|
|
197
197
|
return newField;
|
|
198
198
|
|
|
@@ -326,8 +326,8 @@ export default function (config = {}) {
|
|
|
326
326
|
|
|
327
327
|
function createFieldForSfs4900Comparison(field, tag) {
|
|
328
328
|
const clonedField = clone(field);
|
|
329
|
-
clonedField.tag = tag;
|
|
330
|
-
clonedField.subfields = clonedField.subfields.filter(sf => sf.code !== '9' || sf.value !== sfs4900Trans);
|
|
329
|
+
clonedField.tag = tag;
|
|
330
|
+
clonedField.subfields = clonedField.subfields.filter(sf => sf.code !== '9' || sf.value !== sfs4900Trans);
|
|
331
331
|
return fieldStripPunctuation(clonedField);
|
|
332
332
|
}
|
|
333
333
|
|
|
@@ -348,7 +348,7 @@ export default function (config = {}) {
|
|
|
348
348
|
const newSFS4900Field = config.doSFS4900Transliteration ? mapFieldToSfs4900(field, occurrenceNumberAsString, languageCode) : undefined; // SFS-4900
|
|
349
349
|
|
|
350
350
|
// Trigger the drop of original counterpart $6 :
|
|
351
|
-
pairedField.cyrilluxSkip = 1;
|
|
351
|
+
pairedField.cyrilluxSkip = 1;
|
|
352
352
|
|
|
353
353
|
return [newMainField, newCyrillicField, newSFS4900Field].filter(f => f);
|
|
354
354
|
}
|
|
@@ -83,14 +83,14 @@ export default function () {
|
|
|
83
83
|
|
|
84
84
|
// fixer:
|
|
85
85
|
if (reallyFix) {
|
|
86
|
-
currField.subfields = currField.subfields.filter(sf => !deletableStrings.includes(subfieldToString(sf)));
|
|
86
|
+
currField.subfields = currField.subfields.filter(sf => !deletableStrings.includes(subfieldToString(sf)));
|
|
87
87
|
fieldFixPunctuation(currField);
|
|
88
88
|
return fix490x(recordType, remainingFields, reallyFix, message);
|
|
89
89
|
}
|
|
90
90
|
// validators:
|
|
91
91
|
const clonedField = clone(currField);
|
|
92
92
|
const originalString = fieldToString(clonedField);
|
|
93
|
-
clonedField.subfields = clonedField.subfields.filter(sf => !deletableStrings.includes(subfieldToString(sf)));
|
|
93
|
+
clonedField.subfields = clonedField.subfields.filter(sf => !deletableStrings.includes(subfieldToString(sf)));
|
|
94
94
|
|
|
95
95
|
const newMessage = `Replace '${originalString}' with '${fieldToString(clonedField)}'`;
|
|
96
96
|
|
|
@@ -198,7 +198,7 @@ export function search(sruClient, query, one = false) {
|
|
|
198
198
|
|
|
199
199
|
sruClient.searchRetrieve(query)
|
|
200
200
|
.on('record', xmlString => {
|
|
201
|
-
promises.push(MARCXML.from(xmlString, noValidation));
|
|
201
|
+
promises.push(MARCXML.from(xmlString, noValidation));
|
|
202
202
|
})
|
|
203
203
|
.on('end', async () => {
|
|
204
204
|
try {
|
package/src/double-commas.js
CHANGED
|
@@ -6,8 +6,8 @@ export default function () {
|
|
|
6
6
|
.get(/^700$/u)
|
|
7
7
|
.some(f => f.subfields.every(sf => sf.code === 'e' && (/,,/u).test(sf.value)))
|
|
8
8
|
}),
|
|
9
|
-
fix: record => record.get(/^700$/u).forEach(f => f.subfields.filter(sf => sf.code === 'e').forEach(sf => {
|
|
10
|
-
sf.value = sf.value.replace(/,,/u, ',');
|
|
9
|
+
fix: record => record.get(/^700$/u).forEach(f => f.subfields.filter(sf => sf.code === 'e').forEach(sf => { // eslint-disable-line array-callback-return
|
|
10
|
+
sf.value = sf.value.replace(/,,/u, ',');
|
|
11
11
|
}))
|
|
12
12
|
};
|
|
13
13
|
}
|
package/src/duplicates-ind1.js
CHANGED
|
@@ -20,7 +20,7 @@ export default function (tagPattern) {
|
|
|
20
20
|
iterateFields(record)
|
|
21
21
|
.filter(item => item.validation === false)
|
|
22
22
|
.map(({validation, ...item}) => item) // eslint-disable-line no-unused-vars
|
|
23
|
-
.forEach(({obj}) => record.removeField(obj));
|
|
23
|
+
.forEach(({obj}) => record.removeField(obj)); // eslint-disable-line array-callback-return
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function iterateFields(record) {
|
package/src/empty-fields.js
CHANGED
|
@@ -33,15 +33,15 @@ export default function () {
|
|
|
33
33
|
function fix(record) {
|
|
34
34
|
const errors = findErrors(record.fields);
|
|
35
35
|
errors.forEach(error => {
|
|
36
|
-
if (error.code === ERRORS.MISSING_SUBFIELD_VALUES) {
|
|
37
|
-
if (error.emptySubfields.length === error.field.subfields.length) {
|
|
36
|
+
if (error.code === ERRORS.MISSING_SUBFIELD_VALUES) {
|
|
37
|
+
if (error.emptySubfields.length === error.field.subfields.length) {
|
|
38
38
|
record.removeField(error.field);
|
|
39
|
-
} else {
|
|
39
|
+
} else {
|
|
40
40
|
error.emptySubfields.forEach(sf => {
|
|
41
41
|
record.removeSubfield(sf, error.field);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
} else {
|
|
44
|
+
} else {
|
|
45
45
|
record.removeField(error.field);
|
|
46
46
|
}
|
|
47
47
|
});
|
|
@@ -26,9 +26,6 @@
|
|
|
26
26
|
*
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
/* eslint-disable complexity, max-params */
|
|
30
|
-
|
|
31
|
-
|
|
32
29
|
// Import {validPuncMarks, finnishTerms, confSpec} from './ending-punctuation-conf.js';
|
|
33
30
|
import {validPuncMarks, finnishTerms, confSpec} from './ending-punctuation-conf';
|
|
34
31
|
import createDebugLogger from 'debug';
|
|
@@ -48,8 +45,8 @@ export default function () {
|
|
|
48
45
|
function validatePunc(record, fix) {
|
|
49
46
|
const message = {message: []};
|
|
50
47
|
|
|
51
|
-
if (fix) {
|
|
52
|
-
message.fix = [];
|
|
48
|
+
if (fix) {
|
|
49
|
+
message.fix = [];
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
// Actual parsing of all fields
|
|
@@ -61,7 +58,7 @@ export default function () {
|
|
|
61
58
|
validateField(field, false, fix, message);
|
|
62
59
|
});
|
|
63
60
|
|
|
64
|
-
message.valid = !(message.message.length >= 1);
|
|
61
|
+
message.valid = !(message.message.length >= 1);
|
|
65
62
|
return message;
|
|
66
63
|
}
|
|
67
64
|
}
|
|
@@ -83,52 +80,52 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
83
80
|
// Last char should be punc, but its not one of marks nor dot
|
|
84
81
|
if (punc && !(lastPuncMark || lastPuncDot)) {
|
|
85
82
|
// Console.log("1. Invalid punctuation - missing")
|
|
86
|
-
message.message.push(`Field ${tag} has invalid ending punctuation`);
|
|
87
|
-
if (fix) {
|
|
88
|
-
subfield.value = subfield.value.concat('.');
|
|
89
|
-
message.fix.push(`Field ${tag} - Added punctuation to $${subfield.code}`);
|
|
83
|
+
message.message.push(`Field ${tag} has invalid ending punctuation`);
|
|
84
|
+
if (fix) {
|
|
85
|
+
subfield.value = subfield.value.concat('.');
|
|
86
|
+
message.fix.push(`Field ${tag} - Added punctuation to $${subfield.code}`);
|
|
90
87
|
}
|
|
91
88
|
|
|
92
89
|
// Last char is dot, but previous char is one of punc marks, like 'Question?.'
|
|
93
90
|
} else if (lastPuncDot && subfield.value.length > 1 && puncMarks.includes(subfield.value.charAt(subfield.value.length - 2))) {
|
|
94
91
|
// Console.log("2. Invalid punctuation - duplicate, like '?.'")
|
|
95
|
-
message.message.push(`Field ${tag} has invalid ending punctuation`);
|
|
96
|
-
if (fix) {
|
|
97
|
-
subfield.value = subfield.value.slice(0, -1);
|
|
98
|
-
message.fix.push(`Field ${tag} - Removed double punctuation from $${subfield.code}`);
|
|
92
|
+
message.message.push(`Field ${tag} has invalid ending punctuation`);
|
|
93
|
+
if (fix) {
|
|
94
|
+
subfield.value = subfield.value.slice(0, -1);
|
|
95
|
+
message.fix.push(`Field ${tag} - Removed double punctuation from $${subfield.code}`);
|
|
99
96
|
}
|
|
100
97
|
|
|
101
98
|
// Last char shouldn't be dot !! This is behind checkEnd boolean, because of dots at end of abbreviations, so this is checked only in special cases !!//
|
|
102
99
|
} else if (checkEnd && (!punc && lastPuncDot)) {
|
|
103
100
|
// Console.log("3. Invalid punctuation - Shouldn't be dot, is")
|
|
104
|
-
message.message.push(`Field ${tag} has invalid ending punctuation`);
|
|
105
|
-
if (fix) {
|
|
106
|
-
subfield.value = subfield.value.slice(0, -1);
|
|
107
|
-
message.fix.push(`Field ${tag} - Removed punctuation from $${subfield.code}`);
|
|
101
|
+
message.message.push(`Field ${tag} has invalid ending punctuation`);
|
|
102
|
+
if (fix) {
|
|
103
|
+
subfield.value = subfield.value.slice(0, -1);
|
|
104
|
+
message.fix.push(`Field ${tag} - Removed punctuation from $${subfield.code}`);
|
|
108
105
|
}
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
108
|
|
|
112
109
|
// Special cases from here on
|
|
113
110
|
function specialCases(res, field, tag) {
|
|
114
|
-
let lastSubField = null;
|
|
111
|
+
let lastSubField = null;
|
|
115
112
|
// Punctuation should be only after specific field
|
|
116
113
|
if (res.special.afterOnly) {
|
|
117
114
|
lastSubField = findLastSubfield(field);
|
|
118
115
|
|
|
119
116
|
if (lastSubField) {
|
|
120
|
-
if (typeof res.special.strict === 'undefined') {
|
|
121
|
-
res.special.strict = true;
|
|
117
|
+
if (typeof res.special.strict === 'undefined') {
|
|
118
|
+
res.special.strict = true;
|
|
122
119
|
}
|
|
123
120
|
|
|
124
|
-
if (lastSubField.code === res.special.afterOnly) {
|
|
121
|
+
if (lastSubField.code === res.special.afterOnly) {
|
|
125
122
|
normalPuncRules(lastSubField, res.punc, tag, res.special.strict, false);
|
|
126
|
-
} else {
|
|
123
|
+
} else {
|
|
127
124
|
normalPuncRules(lastSubField, !res.punc, tag, true, false);
|
|
128
125
|
}
|
|
129
126
|
}
|
|
130
127
|
} else if (res.special.noPuncIfField) {
|
|
131
|
-
if (field.subfields.some(subField => subField.code === res.special.noPuncIfField) === false) {
|
|
128
|
+
if (field.subfields.some(subField => subField.code === res.special.noPuncIfField) === false) {
|
|
132
129
|
lastSubField = findLastSubfield(field);
|
|
133
130
|
normalPuncRules(lastSubField, res.punc, tag, true, false);
|
|
134
131
|
}
|
|
@@ -136,25 +133,25 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
136
133
|
lastSubField = findLastSubfield(field);
|
|
137
134
|
if (lastSubField && lastSubField.code === res.special.puncSubField) {
|
|
138
135
|
// Ind2 match, check second if at punc rules with special punc char override
|
|
139
|
-
if (res.special.ifInd2 && res.special.ifInd2.includes(field.ind2)) {
|
|
136
|
+
if (res.special.ifInd2 && res.special.ifInd2.includes(field.ind2)) {
|
|
140
137
|
normalPuncRules(lastSubField, res.special.ifBoth, tag, true, res.special.ifLastCharNot);
|
|
141
138
|
|
|
142
139
|
// Matches execption to special rule, noPuncIfInd2 (likely with value 4, that indicates copyright mark)
|
|
143
|
-
} else if (res.special.noPuncIfInd2 && field.ind2 && res.special.noPuncIfInd2.includes(field.ind2)) {
|
|
140
|
+
} else if (res.special.noPuncIfInd2 && field.ind2 && res.special.noPuncIfInd2.includes(field.ind2)) {
|
|
144
141
|
normalPuncRules(lastSubField, !res.special.ifBoth, tag, true, res.special.ifLastCharNot);
|
|
145
142
|
|
|
146
143
|
// Does not match rules -> shouldn't have punc
|
|
147
|
-
} else {
|
|
144
|
+
} else {
|
|
148
145
|
normalPuncRules(lastSubField, !res.special.ifBoth, tag, true, res.special.ifLastCharNot);
|
|
149
146
|
}
|
|
150
147
|
}
|
|
151
|
-
} else if (res.special.secondLastIfLast) {
|
|
148
|
+
} else if (res.special.secondLastIfLast) {
|
|
152
149
|
field.subfields.forEach(subField => {
|
|
153
|
-
if (isNaN(subField.code) && res.special.secondLastIfLast !== subField.code) {
|
|
150
|
+
if (isNaN(subField.code) && res.special.secondLastIfLast !== subField.code) {
|
|
154
151
|
lastSubField = subField;
|
|
155
152
|
} // Not control field
|
|
156
153
|
|
|
157
|
-
if (typeof res.special.last !== 'undefined' && res.special.secondLastIfLast === subField.code) {
|
|
154
|
+
if (typeof res.special.last !== 'undefined' && res.special.secondLastIfLast === subField.code) {
|
|
158
155
|
normalPuncRules(subField, res.special.last, tag, true, false);
|
|
159
156
|
} // Strict because this field should not be abbreviation
|
|
160
157
|
});
|
|
@@ -166,10 +163,10 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
166
163
|
|
|
167
164
|
if (lastSubField) {
|
|
168
165
|
const languageField = field.subfields.find(({code}) => code === res.special.termField);
|
|
169
|
-
if (languageField && languageField.value && finnishTerms.some(p => p.test(languageField.value))) {
|
|
166
|
+
if (languageField && languageField.value && finnishTerms.some(p => p.test(languageField.value))) {
|
|
170
167
|
// If (languageField && languageField.value && finnishTerms.indexOf(languageField.value) > -1) {
|
|
171
168
|
normalPuncRules(lastSubField, res.punc, tag, true, false);
|
|
172
|
-
} else {
|
|
169
|
+
} else {
|
|
173
170
|
normalPuncRules(lastSubField, res.special.else, tag, false, false); // Strict because of years etc (648, 650)
|
|
174
171
|
}
|
|
175
172
|
}
|
|
@@ -177,22 +174,22 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
177
174
|
} else if (res.special.lastOf) {
|
|
178
175
|
lastSubField = null;
|
|
179
176
|
field.subfields.filter(subField => 'value' in subField).forEach(subField => {
|
|
180
|
-
if (isNaN(subField.code) && res.special.lastOf.indexOf(subField.code) > -1) {
|
|
177
|
+
if (isNaN(subField.code) && res.special.lastOf.indexOf(subField.code) > -1) {
|
|
181
178
|
lastSubField = subField;
|
|
182
179
|
} // Not control field
|
|
183
180
|
|
|
184
|
-
if (res.special.mandatory && res.special.mandatory.indexOf(subField.code) > -1) {
|
|
181
|
+
if (res.special.mandatory && res.special.mandatory.indexOf(subField.code) > -1) {
|
|
185
182
|
normalPuncRules(subField, res.punc, tag, true, false);
|
|
186
183
|
} // Strict because of mandatory
|
|
187
184
|
});
|
|
188
185
|
|
|
189
|
-
if (lastSubField) {
|
|
186
|
+
if (lastSubField) {
|
|
190
187
|
normalPuncRules(lastSubField, res.punc, tag, false, false);
|
|
191
188
|
}
|
|
192
189
|
|
|
193
190
|
// If field has linked rules (tag: 880), find rules and re-validate
|
|
194
|
-
} else if (res.special.linked) {
|
|
195
|
-
let linkedTag = null;
|
|
191
|
+
} else if (res.special.linked) {
|
|
192
|
+
let linkedTag = null;
|
|
196
193
|
try {
|
|
197
194
|
linkedTag = parseInt(field.subfields.find(({code}) => code === res.special.linked).value.substr(0, 3), 10); // Substring feels stupid, but is used in MarcRecord to extract tag.
|
|
198
195
|
} catch (err) {
|
|
@@ -204,13 +201,13 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
204
201
|
}
|
|
205
202
|
}
|
|
206
203
|
|
|
207
|
-
let res = null;
|
|
208
|
-
let tag = null;
|
|
209
|
-
let lastSubField = null;
|
|
204
|
+
let res = null;
|
|
205
|
+
let tag = null;
|
|
206
|
+
let lastSubField = null;
|
|
210
207
|
|
|
211
|
-
if (linkedTag) {
|
|
208
|
+
if (linkedTag) {
|
|
212
209
|
tag = linkedTag;
|
|
213
|
-
} else {
|
|
210
|
+
} else {
|
|
214
211
|
try {
|
|
215
212
|
tag = parseInt(field.tag, 10);
|
|
216
213
|
} catch (err) {
|
|
@@ -231,7 +228,7 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
231
228
|
|
|
232
229
|
// Field does not have subfields; invalid
|
|
233
230
|
if (typeof field.subfields === 'undefined' || field.subfields === null) {
|
|
234
|
-
message.message.push(`Field ${field.tag} has invalid ending punctuation`);
|
|
231
|
+
message.message.push(`Field ${field.tag} has invalid ending punctuation`);
|
|
235
232
|
return;
|
|
236
233
|
}
|
|
237
234
|
|
|
@@ -239,10 +236,10 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
239
236
|
if (typeof res.special === 'undefined' || res.special === null) {
|
|
240
237
|
lastSubField = findLastSubfield(field);
|
|
241
238
|
|
|
242
|
-
if (lastSubField) {
|
|
239
|
+
if (lastSubField) {
|
|
243
240
|
normalPuncRules(lastSubField, res.punc, field.tag, false, false, fix, message);
|
|
244
241
|
}
|
|
245
|
-
} else {
|
|
242
|
+
} else {
|
|
246
243
|
try {
|
|
247
244
|
specialCases(res, field, field.tag);
|
|
248
245
|
} catch (e) {
|
|
@@ -253,13 +250,13 @@ function validateField(field, linkedTag, fix, message) {
|
|
|
253
250
|
|
|
254
251
|
export function validateSingleField(field, linkedTag, fix) {
|
|
255
252
|
const message = {};
|
|
256
|
-
message.message = [];
|
|
257
|
-
if (fix) {
|
|
258
|
-
message.fix = [];
|
|
253
|
+
message.message = [];
|
|
254
|
+
if (fix) {
|
|
255
|
+
message.fix = [];
|
|
259
256
|
}
|
|
260
257
|
|
|
261
258
|
validateField(field, linkedTag, fix, message);
|
|
262
|
-
message.valid = !(message.message.length >= 1);
|
|
259
|
+
message.valid = !(message.message.length >= 1);
|
|
263
260
|
return message;
|
|
264
261
|
}
|
|
265
262
|
|
package/src/ending-whitespace.js
CHANGED
|
@@ -18,7 +18,6 @@ export default function () {
|
|
|
18
18
|
return valid ? {valid, messages: []} : {valid, messages};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/* eslint-disable functional/immutable-data,functional/no-conditional-statements */
|
|
22
21
|
function fix(record) {
|
|
23
22
|
record.fields.forEach(({subfields}) => {
|
|
24
23
|
if (subfields === undefined) {
|
|
@@ -32,7 +31,6 @@ export default function () {
|
|
|
32
31
|
});
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
|
-
/* eslint-enable functional/immutable-data,functional/no-conditional-statements */
|
|
36
34
|
|
|
37
35
|
function valueEndsWithWhitespace({value}) {
|
|
38
36
|
return (/\s$/u).test(value);
|
|
@@ -30,7 +30,7 @@ export default function () {
|
|
|
30
30
|
validateField(field, res, typeOfMaterial);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
res.valid = !(res.message.length >= 1);
|
|
33
|
+
res.valid = !(res.message.length >= 1);
|
|
34
34
|
return res;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -43,7 +43,7 @@ export default function () {
|
|
|
43
43
|
const normalizedField = justifyAndSortField008CharacterGroups(clone(field), typeOfMaterial);
|
|
44
44
|
const mod = fieldToString(normalizedField);
|
|
45
45
|
if (orig !== mod) { // Fail as the input is "broken"/"crap"/sumthing
|
|
46
|
-
res.message.push(`TODO: '${orig}' => '${mod}'`);
|
|
46
|
+
res.message.push(`TODO: '${orig}' => '${mod}'`);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
return;
|
|
@@ -69,7 +69,7 @@ function processCharacterGroup(field, group) {
|
|
|
69
69
|
//console.info(`008/${group.start}-${group.end}: '${originalContent}'`); // eslint-disable-line no-console
|
|
70
70
|
const charArray = content.split('');
|
|
71
71
|
|
|
72
|
-
charArray.sort(function(a, b) {
|
|
72
|
+
charArray.sort(function(a, b) {
|
|
73
73
|
return scoreChar(a) - scoreChar(b);
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -80,7 +80,7 @@ function processCharacterGroup(field, group) {
|
|
|
80
80
|
|
|
81
81
|
//console.info(`'${fieldToString(field)}' =>`); // eslint-disable-line no-console
|
|
82
82
|
|
|
83
|
-
field.value = `${field.value.substring(0, group.start)}${newContent}${field.value.substring(group.end + 1)}`;
|
|
83
|
+
field.value = `${field.value.substring(0, group.start)}${newContent}${field.value.substring(group.end + 1)}`;
|
|
84
84
|
//console.info(`'${fieldToString(field)}'`); // eslint-disable-line no-console
|
|
85
85
|
|
|
86
86
|
function fixBlanks(str) {
|
|
@@ -120,7 +120,7 @@ export function justifyAndSortField008CharacterGroups(field, typeOfMaterial) {
|
|
|
120
120
|
|
|
121
121
|
const relevantCharacterGroups = characterGroups.filter(gr => gr.type === typeOfMaterial);
|
|
122
122
|
|
|
123
|
-
relevantCharacterGroups.forEach(group => processCharacterGroup(field, group));
|
|
123
|
+
relevantCharacterGroups.forEach(group => processCharacterGroup(field, group)); // eslint-disable-line array-callback-return
|
|
124
124
|
|
|
125
125
|
//justifyField008CharacterGroups(field, typeOfMaterial); // Oops: also sorts...
|
|
126
126
|
|
|
@@ -26,7 +26,7 @@ export default function () {
|
|
|
26
26
|
validateField(field, res);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
res.valid = !(res.message.length >= 1);
|
|
29
|
+
res.valid = !(res.message.length >= 1);
|
|
30
30
|
return res;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -36,7 +36,7 @@ export default function () {
|
|
|
36
36
|
const normalizedField = fix505(clone(field));
|
|
37
37
|
const mod = fieldToString(normalizedField);
|
|
38
38
|
if (orig !== mod) { // Fail as the input is "broken"/"crap"/sumthing
|
|
39
|
-
res.message.push(`'TODO: ${orig}' => '${mod}'`);
|
|
39
|
+
res.message.push(`'TODO: ${orig}' => '${mod}'`);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
return;
|
|
@@ -47,10 +47,10 @@ export default function () {
|
|
|
47
47
|
function field505FixSubfieldA(field) {
|
|
48
48
|
const a = field.subfields.filter(sf => sf.code === 'a');
|
|
49
49
|
|
|
50
|
-
a.forEach(sf => fixSubfieldA(sf));
|
|
50
|
+
a.forEach(sf => fixSubfieldA(sf)); // eslint-disable-line array-callback-return
|
|
51
51
|
|
|
52
52
|
function fixSubfieldA(a) {
|
|
53
|
-
a.value = a.value.replace(/ ; /ug, ' -- ');
|
|
53
|
+
a.value = a.value.replace(/ ; /ug, ' -- ');
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -58,13 +58,13 @@ function field505FixSubfieldTRG(field) {
|
|
|
58
58
|
// Modify subfield if next subfield is $t:
|
|
59
59
|
const subfieldsThatWillBeModified = field.subfields.filter((sf, i) => i + 1 < field.subfields.length && field.subfields[i + 1].code === 't');
|
|
60
60
|
|
|
61
|
-
subfieldsThatWillBeModified.forEach(sf => fixSubfieldThatPrecedesT(sf));
|
|
61
|
+
subfieldsThatWillBeModified.forEach(sf => fixSubfieldThatPrecedesT(sf)); // eslint-disable-line array-callback-return
|
|
62
62
|
|
|
63
63
|
function fixSubfieldThatPrecedesT(sf) {
|
|
64
64
|
if (!sf.value) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
sf.value = sf.value.replace(/ ;$/u, ' --');
|
|
67
|
+
sf.value = sf.value.replace(/ ;$/u, ' --');
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
package/src/field-521-fix.js
CHANGED
|
@@ -33,7 +33,7 @@ export default function () {
|
|
|
33
33
|
validateField(field, res);
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
res.valid = !(res.message.length >= 1);
|
|
36
|
+
res.valid = !(res.message.length >= 1);
|
|
37
37
|
return res;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ export default function () {
|
|
|
43
43
|
const normalizedField = fix521(clone(field));
|
|
44
44
|
const mod = fieldToString(normalizedField);
|
|
45
45
|
if (orig !== mod) { // Fail as the input is "broken"/"crap"/sumthing
|
|
46
|
-
res.message.push(`'TODO: ${orig}' => '${mod}'`);
|
|
46
|
+
res.message.push(`'TODO: ${orig}' => '${mod}'`);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
return;
|
|
@@ -51,15 +51,15 @@ export default function () {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function fixSubfieldA(a) {
|
|
54
|
-
a.value = a.value.
|
|
54
|
+
a.value = a.value.
|
|
55
55
|
// MET-332:
|
|
56
|
-
replace(/^(Ikäsuositus) ([0-9])/u, '$1: $2');
|
|
56
|
+
replace(/^(Ikäsuositus) ([0-9])/u, '$1: $2');
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function fixSubfieldAInternalPunctuation(field) {
|
|
60
60
|
const a = field.subfields.filter(sf => sf.code === 'a');
|
|
61
61
|
|
|
62
|
-
a.forEach(sf => fixSubfieldA(sf));
|
|
62
|
+
a.forEach(sf => fixSubfieldA(sf)); // eslint-disable-line array-callback-return
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function getIndicator1(field) {
|
|
@@ -75,7 +75,7 @@ function getIndicator1(field) {
|
|
|
75
75
|
function fixIndicator1(field) {
|
|
76
76
|
const value = getIndicator1(field);
|
|
77
77
|
if (value) {
|
|
78
|
-
field.ind1 = value;
|
|
78
|
+
field.ind1 = value;
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
|
package/src/field-exclusion.js
CHANGED
|
@@ -69,8 +69,8 @@ export default function (config) {
|
|
|
69
69
|
forEach(obj, ([key, val]) => {
|
|
70
70
|
configMatchesSpec(val, key, confSpec);
|
|
71
71
|
// Concat all excluded elements to array
|
|
72
|
-
if (confSpec[key].excl) {
|
|
73
|
-
excluded.push(...confSpec[key].excl);
|
|
72
|
+
if (confSpec[key].excl) {
|
|
73
|
+
excluded.push(...confSpec[key].excl);
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -97,10 +97,10 @@ export default function (config) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// Check subfields recursively
|
|
100
|
-
if (key === 'subfields') {
|
|
100
|
+
if (key === 'subfields') {
|
|
101
101
|
forEach(data, ([, subObj]) => {
|
|
102
102
|
// Console.log("subObj: ", subObj, " type: ", typeof subObj, !(Array.isArray(subObj)))
|
|
103
|
-
if (typeof subObj === 'object' && !Array.isArray(subObj)) {
|
|
103
|
+
if (typeof subObj === 'object' && !Array.isArray(subObj)) {
|
|
104
104
|
checkMandatory(spec[key], subObj);
|
|
105
105
|
|
|
106
106
|
forEach(subObj, ([subKey, subVal]) => {
|
|
@@ -112,7 +112,7 @@ export default function (config) {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
if (key === 'dependencies') {
|
|
115
|
+
if (key === 'dependencies') {
|
|
116
116
|
forEach(data, ([, subObj]) => {
|
|
117
117
|
if (!(typeof subObj === 'object' && !Array.isArray(subObj) && Object.keys(subObj).length === 1 && isRegExp(subObj.leader))) {
|
|
118
118
|
throw new TypeError('Configuration not valid - Invalid dependencies config');
|
|
@@ -177,21 +177,21 @@ export default function (config) {
|
|
|
177
177
|
return false;
|
|
178
178
|
})) {
|
|
179
179
|
// All configuration fields match, element should be excluded.
|
|
180
|
-
if (fix) {
|
|
181
|
-
excluded.push(element);
|
|
182
|
-
} else {
|
|
183
|
-
res.message.push(`Field $${element.tag} should be excluded`);
|
|
180
|
+
if (fix) {
|
|
181
|
+
excluded.push(element);
|
|
182
|
+
} else {
|
|
183
|
+
res.message.push(`Field $${element.tag} should be excluded`);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
-
excluded.forEach(field => record.removeField(field));
|
|
188
|
+
excluded.forEach(field => record.removeField(field)); // eslint-disable-line array-callback-return
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
// Fix does not send response
|
|
192
192
|
if (!fix) {
|
|
193
|
-
if (res.message.length > 0) {
|
|
194
|
-
res.valid = false;
|
|
193
|
+
if (res.message.length > 0) {
|
|
194
|
+
res.valid = false;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
return res;
|
|
@@ -318,7 +318,7 @@ describe('field-exclusion', () => {
|
|
|
318
318
|
describe('#validate: Simple multi tag configuration (spec)', () => {
|
|
319
319
|
const config = [
|
|
320
320
|
{
|
|
321
|
-
tag: /^(648|650|651|655)$/u
|
|
321
|
+
tag: /^(648|650|651|655)$/u
|
|
322
322
|
}
|
|
323
323
|
];
|
|
324
324
|
|
|
@@ -427,7 +427,7 @@ describe('field-exclusion', () => {
|
|
|
427
427
|
|
|
428
428
|
// Simple multi tag configuration
|
|
429
429
|
describe('#validate: Simple multi tag configuration - No object (spec)', () => {
|
|
430
|
-
const config = [/^(648|650|651|655)$/u];
|
|
430
|
+
const config = [/^(648|650|651|655)$/u];
|
|
431
431
|
|
|
432
432
|
const recordValid = new MarcRecord({
|
|
433
433
|
leader: 'foo',
|
|
@@ -617,8 +617,8 @@ describe('field-exclusion', () => {
|
|
|
617
617
|
describe('#validate: Complex multi tag configuration (spec)', () => {
|
|
618
618
|
const config = [
|
|
619
619
|
{
|
|
620
|
-
tag: /^(648|650|651|655)$/u,
|
|
621
|
-
subfields: [{code: /^2$/u, value: /^(ysa|musa|allars|cilla)$/u}]
|
|
620
|
+
tag: /^(648|650|651|655)$/u,
|
|
621
|
+
subfields: [{code: /^2$/u, value: /^(ysa|musa|allars|cilla)$/u}]
|
|
622
622
|
}
|
|
623
623
|
];
|
|
624
624
|
|