@natlibfi/marc-record-validators-melinda 11.5.4 → 11.5.5
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/dist/ending-punctuation-conf.js +1 -1
- package/dist/ending-punctuation-conf.js.map +1 -1
- package/dist/ending-punctuation.spec.js +48 -25
- package/dist/ending-punctuation.spec.js.map +1 -1
- package/package.json +10 -9
- package/src/ending-punctuation-conf.js +2 -19
- package/src/ending-punctuation.spec.js +42 -43
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "git@github.com:natlibfi/marc-record-validators-melinda.git"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"version": "11.5.
|
|
17
|
+
"version": "11.5.5",
|
|
18
18
|
"main": "./dist/index.js",
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
@@ -38,33 +38,34 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@natlibfi/issn-verify": "^1.0.6",
|
|
41
|
-
"@natlibfi/marc-record": "^9.1.
|
|
41
|
+
"@natlibfi/marc-record": "^9.1.4",
|
|
42
42
|
"@natlibfi/marc-record-serializers": "^10.1.2",
|
|
43
43
|
"@natlibfi/marc-record-validate": "^8.0.12",
|
|
44
44
|
"@natlibfi/melinda-commons": "^13.0.19",
|
|
45
|
-
"@natlibfi/sru-client": "^6.0.
|
|
45
|
+
"@natlibfi/sru-client": "^6.0.18",
|
|
46
46
|
"@natlibfi/sfs-4900": "github:NatLibFi/sfs-4900",
|
|
47
47
|
"cld3-asm": "^4.0.0",
|
|
48
48
|
"clone": "^2.1.2",
|
|
49
49
|
"debug": "^4.4.0",
|
|
50
|
-
"isbn3": "^1.2.
|
|
50
|
+
"isbn3": "^1.2.8",
|
|
51
51
|
"iso9_1995": "^0.0.2",
|
|
52
52
|
"langs": "^2.0.0",
|
|
53
53
|
"node-fetch": "^2.7.0",
|
|
54
54
|
"xml2js": "^0.6.2",
|
|
55
|
-
"xregexp": "^5.1.
|
|
55
|
+
"xregexp": "^5.1.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@natlibfi/marc-record-validate": "^8.0.12"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@babel/cli": "^7.26.4",
|
|
62
|
-
"@babel/core": "^7.26.
|
|
63
|
-
"@babel/preset-env": "^7.26.
|
|
62
|
+
"@babel/core": "^7.26.10",
|
|
63
|
+
"@babel/preset-env": "^7.26.9",
|
|
64
64
|
"@babel/register": "^7.25.9",
|
|
65
|
+
"@babel/runtime": "^7.26.10",
|
|
65
66
|
"@natlibfi/eslint-config-melinda-backend": "^3.0.5",
|
|
66
|
-
"@natlibfi/fixugen": "^2.0.
|
|
67
|
-
"@natlibfi/fixura": "^3.0.
|
|
67
|
+
"@natlibfi/fixugen": "^2.0.13",
|
|
68
|
+
"@natlibfi/fixura": "^3.0.12",
|
|
68
69
|
"babel-plugin-istanbul": "^7.0.0",
|
|
69
70
|
"babel-plugin-rewire": "^1.2.0",
|
|
70
71
|
"chai": "^4.5.0",
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
// Const finnishTerms = ['ysa', 'yso', 'kassu', 'seko', 'valo', 'kulo', 'puho', 'oiko', 'mero', 'liito', 'fast', 'allars', 'kaunokki'];
|
|
2
2
|
const finnishTerms = [
|
|
3
|
-
/^ysa$/u,
|
|
4
|
-
/^yso
|
|
5
|
-
/^kassu$/u,
|
|
6
|
-
/^seko$/u,
|
|
7
|
-
/^valo$/u,
|
|
8
|
-
/^kulo$/u,
|
|
9
|
-
/^puho$/u,
|
|
10
|
-
/^oiko$/u,
|
|
11
|
-
/^mero$/u,
|
|
12
|
-
/^liito$/u,
|
|
13
|
-
/^fast$/u,
|
|
14
|
-
/^allars$/u,
|
|
15
|
-
/^kaunokki$/u,
|
|
16
|
-
/^bella$/u,
|
|
17
|
-
/^musa$/u,
|
|
18
|
-
/^local$/u,
|
|
19
|
-
/^slm\//u,
|
|
20
|
-
/^yso\//u,
|
|
21
|
-
/^kauno\//u
|
|
3
|
+
/^(?:allars|bella|fast|juho|jupo|kassu|kauno|kaunokki|keko|koko|kulo|liiko|liito|local|mero|mts|musa|oiko|puho|seko|woto|valo|ysa|yso)$/u,
|
|
4
|
+
/^(?:kauno|slm|yso)\//u
|
|
22
5
|
];
|
|
23
6
|
|
|
24
7
|
const validPuncMarks = '?"-!,)]';
|
|
@@ -1509,7 +1509,7 @@ describe('ending-punctuation', () => {
|
|
|
1509
1509
|
// "647-651 EI - EI suomalaisten sanastojen termeihin, muihin sanaston käytännön mukaan, yleensä KYLLÄ"
|
|
1510
1510
|
// Finnish terms at $2:['ysa', 'yso', 'kassu', 'seko', 'valo', 'kulo', 'puho', 'oiko', 'mero', 'liito', 'fast', 'allars']
|
|
1511
1511
|
// Default TRUE, until more special cases are added
|
|
1512
|
-
describe('#647-651 FALSE - If
|
|
1512
|
+
describe('#647-651 FALSE - If Finnish, else TRUE', () => {
|
|
1513
1513
|
// Valid tests
|
|
1514
1514
|
const recordValid647FastEndPunc = new MarcRecord({
|
|
1515
1515
|
leader: '',
|
|
@@ -1517,7 +1517,7 @@ describe('ending-punctuation', () => {
|
|
|
1517
1517
|
{
|
|
1518
1518
|
tag: '647',
|
|
1519
1519
|
ind1: ' ',
|
|
1520
|
-
ind2: '
|
|
1520
|
+
ind2: '7',
|
|
1521
1521
|
subfields: [
|
|
1522
1522
|
{code: 'a', value: 'Hurricane Katrina'},
|
|
1523
1523
|
{code: 'd', value: '(2005)'},
|
|
@@ -1533,7 +1533,7 @@ describe('ending-punctuation', () => {
|
|
|
1533
1533
|
{
|
|
1534
1534
|
tag: '648',
|
|
1535
1535
|
ind1: ' ',
|
|
1536
|
-
ind2: '
|
|
1536
|
+
ind2: '7',
|
|
1537
1537
|
subfields: [
|
|
1538
1538
|
{code: 'a', value: '1900-luku'},
|
|
1539
1539
|
{code: '2', value: 'yso/swe'}
|
|
@@ -1548,7 +1548,7 @@ describe('ending-punctuation', () => {
|
|
|
1548
1548
|
{
|
|
1549
1549
|
tag: '648',
|
|
1550
1550
|
ind1: ' ',
|
|
1551
|
-
ind2: '
|
|
1551
|
+
ind2: '7',
|
|
1552
1552
|
subfields: [
|
|
1553
1553
|
{code: 'a', value: '1862'},
|
|
1554
1554
|
{code: '2', value: 'fast'} // https://www.kansalliskirjasto.fi/extra/marc21/bib/6XX.htm#648
|
|
@@ -1560,16 +1560,15 @@ describe('ending-punctuation', () => {
|
|
|
1560
1560
|
const recordValid650FinNo = new MarcRecord({
|
|
1561
1561
|
leader: '',
|
|
1562
1562
|
fields: [
|
|
1563
|
-
{
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
}
|
|
1563
|
+
{tag: '650', ind1: ' ', ind2: '7', subfields: [
|
|
1564
|
+
{code: 'a', value: 'kirjastot'},
|
|
1565
|
+
{code: 'x', value: 'atk-järjestelmät'},
|
|
1566
|
+
{code: '2', value: 'kauno/fin'}
|
|
1567
|
+
]},
|
|
1568
|
+
{tag: '650', ind1: ' ', ind2: '7', subfields: [
|
|
1569
|
+
{code: 'a', value: 'ajovalot'},
|
|
1570
|
+
{code: '2', value: 'juho'}
|
|
1571
|
+
]}
|
|
1573
1572
|
]
|
|
1574
1573
|
});
|
|
1575
1574
|
|
|
@@ -1594,7 +1593,7 @@ describe('ending-punctuation', () => {
|
|
|
1594
1593
|
{
|
|
1595
1594
|
tag: '650',
|
|
1596
1595
|
ind1: ' ',
|
|
1597
|
-
ind2: '
|
|
1596
|
+
ind2: '7',
|
|
1598
1597
|
subfields: [
|
|
1599
1598
|
{code: 'a', value: 'Career Exploration.'},
|
|
1600
1599
|
{code: '2', value: 'ericd'}
|
|
@@ -1646,7 +1645,7 @@ describe('ending-punctuation', () => {
|
|
|
1646
1645
|
{
|
|
1647
1646
|
tag: '647',
|
|
1648
1647
|
ind1: ' ',
|
|
1649
|
-
ind2: '
|
|
1648
|
+
ind2: '7',
|
|
1650
1649
|
subfields: [
|
|
1651
1650
|
{code: 'a', value: 'Hurricane Katrina'},
|
|
1652
1651
|
{code: 'd', value: '(2005).'},
|
|
@@ -1662,7 +1661,7 @@ describe('ending-punctuation', () => {
|
|
|
1662
1661
|
{
|
|
1663
1662
|
tag: '648',
|
|
1664
1663
|
ind1: ' ',
|
|
1665
|
-
ind2: '
|
|
1664
|
+
ind2: '7',
|
|
1666
1665
|
subfields: [
|
|
1667
1666
|
{code: 'a', value: '1900-luku.'},
|
|
1668
1667
|
{code: '2', value: 'yso/swe'}
|
|
@@ -1677,7 +1676,7 @@ describe('ending-punctuation', () => {
|
|
|
1677
1676
|
{
|
|
1678
1677
|
tag: '648',
|
|
1679
1678
|
ind1: ' ',
|
|
1680
|
-
ind2: '
|
|
1679
|
+
ind2: '7',
|
|
1681
1680
|
subfields: [
|
|
1682
1681
|
{code: 'a', value: '1862.'},
|
|
1683
1682
|
{code: '2', value: 'fast'}
|
|
@@ -1689,16 +1688,15 @@ describe('ending-punctuation', () => {
|
|
|
1689
1688
|
const recordInvalid650FinYes = new MarcRecord({
|
|
1690
1689
|
leader: '',
|
|
1691
1690
|
fields: [
|
|
1692
|
-
{
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
}
|
|
1691
|
+
{tag: '650', ind1: ' ', ind2: '7', subfields: [
|
|
1692
|
+
{code: 'a', value: 'kirjastot'},
|
|
1693
|
+
{code: 'x', value: 'atk-järjestelmät.'},
|
|
1694
|
+
{code: '2', value: 'kauno/fin'}
|
|
1695
|
+
]},
|
|
1696
|
+
{tag: '650', ind1: ' ', ind2: '7', subfields: [
|
|
1697
|
+
{code: 'a', value: 'ajovalot.'},
|
|
1698
|
+
{code: '2', value: 'juho'}
|
|
1699
|
+
]}
|
|
1702
1700
|
]
|
|
1703
1701
|
});
|
|
1704
1702
|
|
|
@@ -1723,7 +1721,7 @@ describe('ending-punctuation', () => {
|
|
|
1723
1721
|
{
|
|
1724
1722
|
tag: '650',
|
|
1725
1723
|
ind1: ' ',
|
|
1726
|
-
ind2: '
|
|
1724
|
+
ind2: '7',
|
|
1727
1725
|
subfields: [
|
|
1728
1726
|
{code: 'a', value: 'Career Exploration'},
|
|
1729
1727
|
{code: '2', value: 'ericd'}
|
|
@@ -1759,11 +1757,12 @@ describe('ending-punctuation', () => {
|
|
|
1759
1757
|
});
|
|
1760
1758
|
});
|
|
1761
1759
|
|
|
1760
|
+
const invalidField650Message = 'Field 650 has invalid ending punctuation';
|
|
1762
1761
|
it('Finds record invalid - 650 Finnish, with punc', async () => {
|
|
1763
1762
|
const validator = await validatorFactory();
|
|
1764
1763
|
const result = await validator.validate(recordInvalid650FinYes);
|
|
1765
1764
|
expect(result).to.eql({
|
|
1766
|
-
message: [
|
|
1765
|
+
message: [invalidField650Message, invalidField650Message],
|
|
1767
1766
|
valid: false
|
|
1768
1767
|
});
|
|
1769
1768
|
});
|
|
@@ -1772,7 +1771,7 @@ describe('ending-punctuation', () => {
|
|
|
1772
1771
|
const validator = await validatorFactory();
|
|
1773
1772
|
const result = await validator.validate(recordInvalid650EngNoControl);
|
|
1774
1773
|
expect(result).to.eql({
|
|
1775
|
-
message: [
|
|
1774
|
+
message: [invalidField650Message],
|
|
1776
1775
|
valid: false
|
|
1777
1776
|
});
|
|
1778
1777
|
});
|
|
@@ -1825,8 +1824,8 @@ describe('ending-punctuation', () => {
|
|
|
1825
1824
|
const result = await validator.fix(recordInvalid650FinYes);
|
|
1826
1825
|
expect(recordInvalid650FinYes.equalsTo(recordValid650FinNo)).to.eql(true);
|
|
1827
1826
|
expect(result).to.eql({
|
|
1828
|
-
message: [
|
|
1829
|
-
fix: ['Field 650 - Removed punctuation from $x'],
|
|
1827
|
+
message: [invalidField650Message, invalidField650Message],
|
|
1828
|
+
fix: ['Field 650 - Removed punctuation from $x', 'Field 650 - Removed punctuation from $a'],
|
|
1830
1829
|
valid: false
|
|
1831
1830
|
});
|
|
1832
1831
|
});
|
|
@@ -1865,7 +1864,7 @@ describe('ending-punctuation', () => {
|
|
|
1865
1864
|
{
|
|
1866
1865
|
tag: '655',
|
|
1867
1866
|
ind1: ' ',
|
|
1868
|
-
ind2: '
|
|
1867
|
+
ind2: '7',
|
|
1869
1868
|
subfields: [
|
|
1870
1869
|
{code: 'a', value: 'kausijulkaisut'},
|
|
1871
1870
|
{code: '2', value: 'yso/eng'}
|
|
@@ -1880,7 +1879,7 @@ describe('ending-punctuation', () => {
|
|
|
1880
1879
|
{
|
|
1881
1880
|
tag: '655',
|
|
1882
1881
|
ind1: ' ',
|
|
1883
|
-
ind2: '
|
|
1882
|
+
ind2: '7',
|
|
1884
1883
|
subfields: [
|
|
1885
1884
|
{code: 'a', value: 'vironkielinen kirjallisuus'},
|
|
1886
1885
|
{code: '2', value: 'local'}
|
|
@@ -1895,7 +1894,7 @@ describe('ending-punctuation', () => {
|
|
|
1895
1894
|
{
|
|
1896
1895
|
tag: '655',
|
|
1897
1896
|
ind1: ' ',
|
|
1898
|
-
ind2: '
|
|
1897
|
+
ind2: '7',
|
|
1899
1898
|
subfields: [
|
|
1900
1899
|
{code: 'a', value: 'Bird\'s-eye views'},
|
|
1901
1900
|
{code: 'y', value: '1874.'},
|
|
@@ -1923,7 +1922,7 @@ describe('ending-punctuation', () => {
|
|
|
1923
1922
|
{
|
|
1924
1923
|
tag: '656',
|
|
1925
1924
|
ind1: ' ',
|
|
1926
|
-
ind2: '
|
|
1925
|
+
ind2: '7',
|
|
1927
1926
|
subfields: [
|
|
1928
1927
|
{code: 'a', value: 'kuvaamataidonopettajat'},
|
|
1929
1928
|
{code: '2', value: 'slm/eng'}
|
|
@@ -1938,7 +1937,7 @@ describe('ending-punctuation', () => {
|
|
|
1938
1937
|
{
|
|
1939
1938
|
tag: '657',
|
|
1940
1939
|
ind1: ' ',
|
|
1941
|
-
ind2: '
|
|
1940
|
+
ind2: '7',
|
|
1942
1941
|
subfields: [
|
|
1943
1942
|
{code: 'a', value: 'Personnel benefits management'},
|
|
1944
1943
|
{code: 'x', value: 'Vital statistics'},
|
|
@@ -2035,7 +2034,7 @@ describe('ending-punctuation', () => {
|
|
|
2035
2034
|
{
|
|
2036
2035
|
tag: '655',
|
|
2037
2036
|
ind1: ' ',
|
|
2038
|
-
ind2: '
|
|
2037
|
+
ind2: '7',
|
|
2039
2038
|
subfields: [
|
|
2040
2039
|
{code: 'a', value: 'kausijulkaisut.'},
|
|
2041
2040
|
{code: '2', value: 'yso/eng'}
|
|
@@ -2050,7 +2049,7 @@ describe('ending-punctuation', () => {
|
|
|
2050
2049
|
{
|
|
2051
2050
|
tag: '655',
|
|
2052
2051
|
ind1: ' ',
|
|
2053
|
-
ind2: '
|
|
2052
|
+
ind2: '7',
|
|
2054
2053
|
subfields: [
|
|
2055
2054
|
{code: 'a', value: 'vironkielinen kirjallisuus.'},
|
|
2056
2055
|
{code: '2', value: 'local'}
|
|
@@ -2065,7 +2064,7 @@ describe('ending-punctuation', () => {
|
|
|
2065
2064
|
{
|
|
2066
2065
|
tag: '655',
|
|
2067
2066
|
ind1: ' ',
|
|
2068
|
-
ind2: '
|
|
2067
|
+
ind2: '7',
|
|
2069
2068
|
subfields: [
|
|
2070
2069
|
{code: 'a', value: 'Bird\'s-eye views'},
|
|
2071
2070
|
{code: 'y', value: '1874'},
|
|
@@ -2093,7 +2092,7 @@ describe('ending-punctuation', () => {
|
|
|
2093
2092
|
{
|
|
2094
2093
|
tag: '656',
|
|
2095
2094
|
ind1: ' ',
|
|
2096
|
-
ind2: '
|
|
2095
|
+
ind2: '7',
|
|
2097
2096
|
subfields: [
|
|
2098
2097
|
{code: 'a', value: 'kuvaamataidonopettajat.'},
|
|
2099
2098
|
{code: '2', value: 'slm/eng'}
|
|
@@ -2108,7 +2107,7 @@ describe('ending-punctuation', () => {
|
|
|
2108
2107
|
{
|
|
2109
2108
|
tag: '657',
|
|
2110
2109
|
ind1: ' ',
|
|
2111
|
-
ind2: '
|
|
2110
|
+
ind2: '7',
|
|
2112
2111
|
subfields: [
|
|
2113
2112
|
{code: 'a', value: 'Personnel benefits management'},
|
|
2114
2113
|
{code: 'x', value: 'Vital statistics'},
|