@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
package/src/punctuation.spec.js
CHANGED
|
@@ -1,151 +1,52 @@
|
|
|
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 './punctuation/';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const validator = await validatorFactory();
|
|
49
|
-
const record = new MarcRecord({
|
|
50
|
-
fields: [
|
|
51
|
-
{
|
|
52
|
-
tag: '100',
|
|
53
|
-
ind2: ' ',
|
|
54
|
-
subfields: [
|
|
55
|
-
{code: 'a', value: 'Sukunimi, Etunimi,'},
|
|
56
|
-
{code: 'c', value: 'kirjoittaja.'}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
});
|
|
61
|
-
const result = await validator.validate(record);
|
|
62
|
-
|
|
63
|
-
expect(result).to.eql({valid: true});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('Finds the record invalid', async () => {
|
|
67
|
-
const validator = await validatorFactory();
|
|
68
|
-
const record = new MarcRecord({
|
|
69
|
-
fields: [
|
|
70
|
-
{
|
|
71
|
-
tag: '100',
|
|
72
|
-
ind2: ' ',
|
|
73
|
-
subfields: [
|
|
74
|
-
{code: 'a', value: 'Sukunimi, Etunimi'},
|
|
75
|
-
{code: 'c', value: 'kirjoittaja.'}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
});
|
|
80
|
-
const result = await validator.validate(record);
|
|
81
|
-
|
|
82
|
-
expect(result).to.eql({valid: false});
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe('#fix', () => {
|
|
87
|
-
it('Creates punctuation for field 100', async () => {
|
|
88
|
-
const validator = await validatorFactory();
|
|
89
|
-
const record = new MarcRecord({
|
|
90
|
-
fields: [
|
|
91
|
-
{
|
|
92
|
-
tag: '100',
|
|
93
|
-
ind1: ' ',
|
|
94
|
-
ind2: ' ',
|
|
95
|
-
subfields: [
|
|
96
|
-
{code: 'a', value: 'Sukunimi, Etunimi'},
|
|
97
|
-
{code: 'c', value: 'kirjoittaja'}
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
await validator.fix(record);
|
|
104
|
-
|
|
105
|
-
expect(record.fields).to.eql([
|
|
106
|
-
{
|
|
107
|
-
tag: '100',
|
|
108
|
-
ind1: ' ',
|
|
109
|
-
ind2: ' ',
|
|
110
|
-
subfields: [
|
|
111
|
-
{code: 'a', value: 'Sukunimi, Etunimi,'},
|
|
112
|
-
{code: 'c', value: 'kirjoittaja.'}
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
]);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/*
|
|
120
|
-
Describe('#fix', () => {
|
|
121
|
-
it('Creates punctuation for field 264', async () => {
|
|
122
|
-
const validator = await validatorFactory();
|
|
123
|
-
const record = new MarcRecord({
|
|
124
|
-
fields: [
|
|
125
|
-
{
|
|
126
|
-
tag: '264',
|
|
127
|
-
ind1: ' ',
|
|
128
|
-
ind2: ' ',
|
|
129
|
-
subfields: [
|
|
130
|
-
{code: 'b', value: 'Julkaisija'},
|
|
131
|
-
{code: 'c', value: '2019'}
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
});
|
|
136
|
-
await validator.fix(record);
|
|
137
|
-
expect(record.fields).to.eql([
|
|
138
|
-
{
|
|
139
|
-
tag: '264',
|
|
140
|
-
ind1: ' ',
|
|
141
|
-
ind2: ' ',
|
|
142
|
-
subfields: [
|
|
143
|
-
{code: 'b', value: 'Julkaisija,'},
|
|
144
|
-
{code: 'c', value: '2019.'}
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
]);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
*/
|
|
4
|
+
import {READERS} from '@natlibfi/fixura';
|
|
5
|
+
import generateTests from '@natlibfi/fixugen';
|
|
6
|
+
import createDebugLogger from 'debug';
|
|
7
|
+
|
|
8
|
+
generateTests({
|
|
9
|
+
callback,
|
|
10
|
+
path: [__dirname, '..', 'test-fixtures', 'punctuation'],
|
|
11
|
+
useMetadataFile: true,
|
|
12
|
+
recurse: false,
|
|
13
|
+
fixura: {
|
|
14
|
+
reader: READERS.JSON
|
|
15
|
+
},
|
|
16
|
+
mocha: {
|
|
17
|
+
before: () => testValidatorFactory()
|
|
18
|
+
}
|
|
151
19
|
});
|
|
20
|
+
const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/punctuation:test');
|
|
21
|
+
|
|
22
|
+
async function testValidatorFactory() {
|
|
23
|
+
const validator = await validatorFactory();
|
|
24
|
+
|
|
25
|
+
expect(validator)
|
|
26
|
+
.to.be.an('object')
|
|
27
|
+
.that.has.any.keys('description', 'validate');
|
|
28
|
+
|
|
29
|
+
expect(validator.description).to.be.a('string');
|
|
30
|
+
expect(validator.validate).to.be.a('function');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function callback({getFixture, enabled = true, fix = false}) {
|
|
34
|
+
if (enabled === false) {
|
|
35
|
+
debug('TEST SKIPPED!');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const validator = await validatorFactory();
|
|
40
|
+
const record = new MarcRecord(getFixture('record.json'));
|
|
41
|
+
const expectedResult = getFixture('expectedResult.json');
|
|
42
|
+
// console.log(expectedResult); // eslint-disable-line
|
|
43
|
+
|
|
44
|
+
if (!fix) {
|
|
45
|
+
const result = await validator.validate(record);
|
|
46
|
+
expect(result).to.eql(expectedResult);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await validator.fix(record);
|
|
51
|
+
expect(record).to.eql(expectedResult);
|
|
52
|
+
}
|
|
@@ -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
|
import {parseString} from 'xml2js';
|
|
30
2
|
import fetch from 'node-fetch';
|
|
31
3
|
|
|
@@ -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 chai from 'chai';
|
|
31
2
|
import chaiAsPromised from 'chai-as-promised';
|
|
32
3
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
@@ -63,7 +34,8 @@ describe('resolvable-ext-references-melinda', () => {
|
|
|
63
34
|
|
|
64
35
|
it('Throws an error when prefixPattern not provided', async () => {
|
|
65
36
|
const validator = await testContext.default({endpoint, prefixPattern, fields});
|
|
66
|
-
|
|
37
|
+
// Cannot read property 'fields' of undefined or Cannot read properties of undefined (reading 'fields')'
|
|
38
|
+
await expect(validator.validate()).to.be.rejectedWith(Error, /^Cannot read propert/u);
|
|
67
39
|
});
|
|
68
40
|
|
|
69
41
|
describe('#validate', () => {
|
package/src/sort-tags.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 {MarcRecord} from '@natlibfi/marc-record';
|
|
31
2
|
|
|
32
3
|
export default function (tagPattern) {
|
package/src/sort-tags.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/sort-tags';
|
|
@@ -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-2022 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
|
// Tag (RegExp): Pattern to match the field's tags Mandatory
|
|
31
2
|
// ind1 (RegExp): Pattern to match the field's ind1 property
|
|
32
3
|
// ind2 (RegExp): Pattern to match the field's ind2 property
|
|
@@ -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-2022 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 chaiAsPromised from 'chai-as-promised';
|
|
32
3
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
4
|
-
*
|
|
5
|
-
* Melinda-related validators for @natlibfi/marc-record-validate
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2017 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 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
|
-
* This program 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 MAP_CONVERSION = {
|
|
30
2
|
|
|
31
3
|
/**
|
|
@@ -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 chai from 'chai';
|
|
31
2
|
import chaiAsPromised from 'chai-as-promised';
|
|
32
3
|
import {MarcRecord} from '@natlibfi/marc-record';
|
package/src/urn.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 fetch from 'node-fetch';
|
|
31
2
|
|
|
32
3
|
const URN_GENERATOR_URL = 'http://generator.urn.fi/cgi-bin/urn_generator.cgi?type=nbn';
|
package/src/urn.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/urn';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_validationOptions": {},
|
|
3
|
+
"leader": "",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"tag": "100",
|
|
7
|
+
"ind1": " ",
|
|
8
|
+
"ind2": " ",
|
|
9
|
+
"subfields": [
|
|
10
|
+
{
|
|
11
|
+
"code": "a",
|
|
12
|
+
"value": "Sukunimi, Etunimi,"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"code": "c",
|
|
16
|
+
"value": "kirjoittaja."
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_validationOptions": {},
|
|
3
|
+
"leader": "",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"tag": "264",
|
|
7
|
+
"ind1": " ",
|
|
8
|
+
"ind2": " ",
|
|
9
|
+
"subfields": [
|
|
10
|
+
{
|
|
11
|
+
"code": "b",
|
|
12
|
+
"value": "Julkaisija,"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"code": "c",
|
|
16
|
+
"value": "2019."
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|