@natlibfi/melinda-record-matching 4.4.0-alpha.1 → 5.0.0-alpha.2

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.
Files changed (123) hide show
  1. package/.github/workflows/melinda-node-tests.yml +13 -9
  2. package/LICENSE.txt +21 -165
  3. package/README.md +2 -2
  4. package/dist/candidate-search/candidate-search-utils.js +6 -43
  5. package/dist/candidate-search/candidate-search-utils.js.map +7 -1
  6. package/dist/candidate-search/choose-queries.js +75 -0
  7. package/dist/candidate-search/choose-queries.js.map +7 -0
  8. package/dist/candidate-search/index.js +89 -225
  9. package/dist/candidate-search/index.js.map +7 -1
  10. package/dist/candidate-search/index.test.js +92 -0
  11. package/dist/candidate-search/index.test.js.map +7 -0
  12. package/dist/candidate-search/query-list/bib.js +141 -320
  13. package/dist/candidate-search/query-list/bib.js.map +7 -1
  14. package/dist/candidate-search/query-list/bib.test.js +34 -0
  15. package/dist/candidate-search/query-list/bib.test.js.map +7 -0
  16. package/dist/candidate-search/query-list/component.js +87 -0
  17. package/dist/candidate-search/query-list/component.js.map +7 -0
  18. package/dist/candidate-search/query-list/index.js +39 -52
  19. package/dist/candidate-search/query-list/index.js.map +7 -1
  20. package/dist/cli.js +138 -0
  21. package/dist/cli.js.map +7 -0
  22. package/dist/index.js +87 -462
  23. package/dist/index.js.map +7 -1
  24. package/dist/index.test.js +69 -0
  25. package/dist/index.test.js.map +7 -0
  26. package/dist/match-detection/features/bib/all-source-ids.js +20 -91
  27. package/dist/match-detection/features/bib/all-source-ids.js.map +7 -1
  28. package/dist/match-detection/features/bib/authors.js +20 -76
  29. package/dist/match-detection/features/bib/authors.js.map +7 -1
  30. package/dist/match-detection/features/bib/bibliographic-level.js +4 -40
  31. package/dist/match-detection/features/bib/bibliographic-level.js.map +7 -1
  32. package/dist/match-detection/features/bib/host-component.js +5 -41
  33. package/dist/match-detection/features/bib/host-component.js.map +7 -1
  34. package/dist/match-detection/features/bib/index.js +17 -119
  35. package/dist/match-detection/features/bib/index.js.map +7 -1
  36. package/dist/match-detection/features/bib/index.test.js +40 -0
  37. package/dist/match-detection/features/bib/index.test.js.map +7 -0
  38. package/dist/match-detection/features/bib/isbn.js +13 -69
  39. package/dist/match-detection/features/bib/isbn.js.map +7 -1
  40. package/dist/match-detection/features/bib/issn.js +5 -50
  41. package/dist/match-detection/features/bib/issn.js.map +7 -1
  42. package/dist/match-detection/features/bib/language.js +25 -86
  43. package/dist/match-detection/features/bib/language.js.map +7 -1
  44. package/dist/match-detection/features/bib/media-type.js +12 -64
  45. package/dist/match-detection/features/bib/media-type.js.map +7 -1
  46. package/dist/match-detection/features/bib/melinda-id.js +5 -47
  47. package/dist/match-detection/features/bib/melinda-id.js.map +7 -1
  48. package/dist/match-detection/features/bib/melinda-identifier-factory.js +16 -67
  49. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +7 -1
  50. package/dist/match-detection/features/bib/other-standard-identifier.js +5 -51
  51. package/dist/match-detection/features/bib/other-standard-identifier.js.map +7 -1
  52. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js +49 -189
  53. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +7 -1
  54. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js +10 -53
  55. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +7 -1
  56. package/dist/match-detection/features/bib/publication-time.js +8 -46
  57. package/dist/match-detection/features/bib/publication-time.js.map +7 -1
  58. package/dist/match-detection/features/bib/record-type.js +4 -43
  59. package/dist/match-detection/features/bib/record-type.js.map +7 -1
  60. package/dist/match-detection/features/bib/standard-identifier-factory.js +47 -163
  61. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +7 -1
  62. package/dist/match-detection/features/bib/title-version-original.js +11 -53
  63. package/dist/match-detection/features/bib/title-version-original.js.map +7 -1
  64. package/dist/match-detection/features/bib/title.js +20 -72
  65. package/dist/match-detection/features/bib/title.js.map +7 -1
  66. package/dist/match-detection/features/index.js +3 -11
  67. package/dist/match-detection/features/index.js.map +7 -1
  68. package/dist/match-detection/index.js +35 -150
  69. package/dist/match-detection/index.js.map +7 -1
  70. package/dist/match-detection/index.test.js +44 -0
  71. package/dist/match-detection/index.test.js.map +7 -0
  72. package/dist/matching-utils.js +38 -102
  73. package/dist/matching-utils.js.map +7 -1
  74. package/eslint.config.js +52 -0
  75. package/example.env +4 -0
  76. package/package.json +29 -78
  77. package/src/candidate-search/candidate-search-utils.js +1 -28
  78. package/src/candidate-search/choose-queries.js +93 -0
  79. package/src/candidate-search/index.js +85 -119
  80. package/src/candidate-search/{index.spec.js → index.test.js} +30 -43
  81. package/src/candidate-search/query-list/bib.js +54 -55
  82. package/src/candidate-search/query-list/bib.test.js +38 -0
  83. package/src/candidate-search/query-list/component.js +127 -0
  84. package/src/candidate-search/query-list/index.js +31 -35
  85. package/src/cli.js +177 -0
  86. package/src/index.js +27 -68
  87. package/src/{index.spec.js → index.test.js} +11 -42
  88. package/src/match-detection/features/bib/all-source-ids.js +2 -29
  89. package/src/match-detection/features/bib/authors.js +5 -30
  90. package/src/match-detection/features/bib/bibliographic-level.js +0 -27
  91. package/src/match-detection/features/bib/host-component.js +0 -27
  92. package/src/match-detection/features/bib/index.js +16 -43
  93. package/src/match-detection/features/bib/index.test.js +52 -0
  94. package/src/match-detection/features/bib/isbn.js +2 -29
  95. package/src/match-detection/features/bib/issn.js +1 -28
  96. package/src/match-detection/features/bib/language.js +5 -32
  97. package/src/match-detection/features/bib/media-type.js +2 -28
  98. package/src/match-detection/features/bib/melinda-id.js +1 -28
  99. package/src/match-detection/features/bib/melinda-identifier-factory.js +5 -32
  100. package/src/match-detection/features/bib/other-standard-identifier.js +1 -28
  101. package/src/match-detection/features/bib/publication-time-allow-cons-years-multi.js +7 -34
  102. package/src/match-detection/features/bib/publication-time-allow-cons-years.js +1 -28
  103. package/src/match-detection/features/bib/publication-time.js +2 -28
  104. package/src/match-detection/features/bib/record-type.js +0 -27
  105. package/src/match-detection/features/bib/standard-identifier-factory.js +1 -28
  106. package/src/match-detection/features/bib/title-version-original.js +2 -28
  107. package/src/match-detection/features/bib/title.js +6 -34
  108. package/src/match-detection/features/index.js +1 -28
  109. package/src/match-detection/index.js +1 -28
  110. package/src/match-detection/{index.spec.js → index.test.js} +9 -35
  111. package/src/matching-utils.js +8 -37
  112. package/dist/candidate-search/index.spec.js +0 -144
  113. package/dist/candidate-search/index.spec.js.map +0 -1
  114. package/dist/candidate-search/query-list/bib.spec.js +0 -64
  115. package/dist/candidate-search/query-list/bib.spec.js.map +0 -1
  116. package/dist/index.spec.js +0 -127
  117. package/dist/index.spec.js.map +0 -1
  118. package/dist/match-detection/features/bib/index.spec.js +0 -93
  119. package/dist/match-detection/features/bib/index.spec.js.map +0 -1
  120. package/dist/match-detection/index.spec.js +0 -91
  121. package/dist/match-detection/index.spec.js.map +0 -1
  122. package/src/candidate-search/query-list/bib.spec.js +0 -54
  123. package/src/match-detection/features/bib/index.spec.js +0 -78
@@ -1,171 +1,77 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _matchingUtils = require("../../../matching-utils");
8
- var _debug = _interopRequireDefault(require("debug"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- /**
11
- *
12
- * @licstart The following is the entire license notice for the JavaScript code in this file.
13
- *
14
- * Melinda record matching modules for Javascript
15
- *
16
- * Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)
17
- *
18
- * This file is part of melinda-record-matching-js
19
- *
20
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
21
- * it under the terms of the GNU Lesser General Public License as
22
- * published by the Free Software Foundation, either version 3 of the
23
- * License, or (at your option) any later version.
24
- *
25
- * melinda-record-matching-js is distributed in the hope that it will be useful,
26
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
- * GNU Lesser General Public License for more details.
29
- *
30
- * You should have received a copy of the GNU Affero General Public License
31
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
- *
33
- * @licend The above is the entire license notice
34
- * for the JavaScript code in this file.
35
- *
36
- */
37
- // We should also get copyright time and copyright/publication times from 26x
38
- // We should also get publishing time type from f008
39
- // We should get reprint times from f500 $a "Lisäpainos/Lisäpainokset:"
40
- var _default = () => ({
41
- name: 'Publication time, allow consequent years, years from multiple sources',
42
- extract: ({
43
- record,
44
- recordExternal
45
- }) => {
46
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');
47
- const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
1
+ import createDebugLogger from "debug";
2
+ import { testStringOrNumber } from "../../../matching-utils.js";
3
+ export default () => ({
4
+ name: "Publication time, allow consequent years, years from multiple sources",
5
+ extract: ({ record, recordExternal }) => {
6
+ const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi");
7
+ const label = recordExternal && recordExternal.label ? recordExternal.label : "record";
48
8
  const f008Values = extractF008Values(record);
49
- debug(`${label} f008: ${JSON.stringify(f008Values)}`);
9
+ debug(`${label}: f008: ${JSON.stringify(f008Values)}`);
50
10
  const f26xValues = extractF26xValues(record);
51
- debug(`${label} f26x: ${JSON.stringify(f26xValues)}`);
11
+ debug(`${label}: f26x: ${JSON.stringify(f26xValues)}`);
52
12
  const f500Values = extractF500Years(record);
53
- debug(`${label} f500: ${JSON.stringify(f500Values)}`);
54
-
55
- // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'
56
- // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?
57
- // We should handle unknown years (here or comparison?)
58
- // We should handle year ranges for continuing resources / collections
59
-
60
- const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();
13
+ debug(`${label}: f500: ${JSON.stringify(f500Values)}`);
14
+ const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter((value) => value && value !== " " && value !== "||||"))].sort();
61
15
  const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();
62
16
  const reprintYears = [...new Set(f500Values)].sort();
63
- const combined = {
64
- normalYears,
65
- copyrightYears,
66
- reprintYears
67
- };
17
+ const combined = { normalYears, copyrightYears, reprintYears };
68
18
  debug(`Combined: ${JSON.stringify(combined)}`);
69
19
  return combined;
70
- function extractF008Values(record) {
71
- // Record should have only one f008 - in case of several, we handle the first one
72
- const value = record.get(/^008$/u)?.[0]?.value || undefined;
73
- if (value && (0, _matchingUtils.testStringOrNumber)(value)) {
20
+ function extractF008Values(record2) {
21
+ const value = record2.get(/^008$/u)?.[0]?.value || void 0;
22
+ if (value && testStringOrNumber(value)) {
74
23
  const f008Date1 = extractF008Date1(value);
75
24
  const f008Date2 = extractF008Date2(value);
76
25
  const f008YearType = extractF008YearType(value);
77
- return {
78
- f008Date1,
79
- f008Date2,
80
- f008YearType
81
- };
26
+ return { f008Date1, f008Date2, f008YearType };
82
27
  }
83
- return {
84
- f008Date1: undefined,
85
- f008Date2: undefined,
86
- f008YearType: undefined
87
- };
88
- function extractF008Date1(value) {
89
- return String(value).slice(7, 11);
28
+ return { f008Date1: void 0, f008Date2: void 0, f008YearType: void 0 };
29
+ function extractF008Date1(value2) {
30
+ return String(value2).slice(7, 11);
90
31
  }
91
- function extractF008Date2(value) {
92
- return String(value).slice(11, 15);
32
+ function extractF008Date2(value2) {
33
+ return String(value2).slice(11, 15);
93
34
  }
94
- function extractF008YearType(value) {
95
- return String(value).slice(6, 7);
35
+ function extractF008YearType(value2) {
36
+ return String(value2).slice(6, 7);
96
37
  }
97
38
  }
98
- function extractF26xValues(record) {
39
+ function extractF26xValues(record2) {
99
40
  const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|©|p|℗)/u;
100
- const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);
41
+ const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record2, copyrightRegex);
101
42
  debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);
102
- const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);
43
+ const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record2);
103
44
  debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);
104
- const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);
45
+ const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record2, copyrightRegex);
105
46
  debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);
106
- return {
107
- normalYears: pubNormalSubFieldValues,
108
- copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]
109
- };
110
- function extractPubNormalSubfieldValues(record, copyrightRegex) {
111
- return record.get(/^26[04]$/u).filter(field => !(field.tag === '264' && field.ind2 === '4')).map(({
112
- subfields
113
- }) => subfields).flat().filter(({
114
- code
115
- }) => code && code === 'c').filter(({
116
- value
117
- }) => value && !copyrightRegex.test(value)).map(({
118
- value
119
- }) => value).map(value => removeNonAlphaNumeric(value));
47
+ return { normalYears: pubNormalSubFieldValues, copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues] };
48
+ function extractPubNormalSubfieldValues(record3, copyrightRegex2) {
49
+ return record3.get(/^26[04]$/u).filter((field) => !(field.tag === "264" && field.ind2 === "4")).map(({ subfields }) => subfields).flat().filter(({ code }) => code && code === "c").filter(({ value }) => value && !copyrightRegex2.test(value)).map(({ value }) => value).map((value) => removeNonAlphaNumeric(value));
120
50
  }
121
- function extractPubF264CopySubfieldValues(record, copyrightRegex) {
122
- return record.get(/^264$/u).filter(field => field.ind2 === '4').map(({
123
- subfields
124
- }) => subfields).flat().filter(({
125
- code
126
- }) => code && code === 'c').filter(({
127
- value
128
- }) => value).map(({
129
- value
130
- }) => value).map(value => value.replace(copyrightRegex, '')).map(value => removeNonAlphaNumeric(value));
51
+ function extractPubF264CopySubfieldValues(record3, copyrightRegex2) {
52
+ return record3.get(/^264$/u).filter((field) => field.ind2 === "4").map(({ subfields }) => subfields).flat().filter(({ code }) => code && code === "c").filter(({ value }) => value).map(({ value }) => value).map((value) => value.replace(copyrightRegex2, "")).map((value) => removeNonAlphaNumeric(value));
131
53
  }
132
- function extractPubF260CopySubfieldValues(record, copyrightRegex) {
133
- return record.get(/^260$/u).map(({
134
- subfields
135
- }) => subfields).flat().filter(({
136
- code
137
- }) => code && code === 'c').filter(({
138
- value
139
- }) => value && copyrightRegex.test(value)).map(({
140
- value
141
- }) => value).map(value => value.replace(copyrightRegex, '')).map(value => removeNonAlphaNumeric(value));
54
+ function extractPubF260CopySubfieldValues(record3, copyrightRegex2) {
55
+ return record3.get(/^260$/u).map(({ subfields }) => subfields).flat().filter(({ code }) => code && code === "c").filter(({ value }) => value && copyrightRegex2.test(value)).map(({ value }) => value).map((value) => value.replace(copyrightRegex2, "")).map((value) => removeNonAlphaNumeric(value));
142
56
  }
143
57
  function removeNonAlphaNumeric(value) {
144
58
  debug(`Cleaning: ${JSON.stringify(value)}`);
145
59
  const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;
146
- return value ? value.replace(nonAlphaNumericRegex, '') : value;
60
+ return value ? value.replace(nonAlphaNumericRegex, "") : value;
147
61
  }
148
62
  }
149
- function extractF500Years(record) {
63
+ function extractF500Years(record2) {
150
64
  const reprintRegex = /(?<reprint>Lisäpainokset:|Lisäpainos:)/u;
151
- const reprintFieldContents = record.get(/^500$/u).map(({
152
- subfields
153
- }) => subfields).flat().filter(({
154
- code
155
- }) => code === 'a').map(({
156
- value
157
- }) => value);
158
- //.filter(value => value.test(reprintRegex));
159
-
65
+ const reprintFieldContents = record2.get(/^500$/u).map(({ subfields }) => subfields).flat().filter(({ code }) => code === "a").map(({ value }) => value);
160
66
  debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);
161
- const filteredF500 = reprintFieldContents.filter(content => content && content.match(reprintRegex));
67
+ const filteredF500 = reprintFieldContents.filter((content) => content && content.match(reprintRegex));
162
68
  debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);
163
- const reprintYears = extractReprintYears(filteredF500);
164
- return reprintYears;
69
+ const reprintYears2 = extractReprintYears(filteredF500);
70
+ return reprintYears2;
165
71
  }
166
72
  function extractReprintYears(contents) {
167
73
  const yearRegex = /[0-9][0-9][0-9][0-9]/gu;
168
- const years = contents.map(content => content.match(yearRegex)).flat();
74
+ const years = contents.map((content) => content.match(yearRegex)).flat();
169
75
  debug(`${JSON.stringify(years)}`);
170
76
  const uniqYears = [...new Set(years)].sort();
171
77
  debug(`${JSON.stringify(uniqYears)}`);
@@ -174,7 +80,7 @@ var _default = () => ({
174
80
  },
175
81
  // eslint-disable-next-line max-statements
176
82
  compare: (a, b) => {
177
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');
83
+ const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi");
178
84
  debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);
179
85
  const [firstA] = a.normalYears ? a.normalYears : a;
180
86
  const [firstB] = b.normalYears ? b.normalYears : b;
@@ -182,34 +88,23 @@ var _default = () => ({
182
88
  if (firstA === firstB) {
183
89
  return 0.1;
184
90
  }
185
-
186
- // If either of years is a non string/number, values are not comparable
187
- if (!(0, _matchingUtils.testStringOrNumber)(firstA) || !(0, _matchingUtils.testStringOrNumber)(firstB)) {
91
+ if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {
188
92
  return 0;
189
93
  }
190
94
  const firstANumber = parseInt(firstA, 10);
191
95
  const firstBNumber = parseInt(firstB, 10);
192
-
193
- // Handle consequent years as a match
194
- // see publication-time for a version that does not handle consequent years as a match
195
96
  if (!(isNaN(firstANumber) || isNaN(firstBNumber)) && (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {
196
97
  return 0.1;
197
98
  }
198
-
199
- // We should do something with copyrightYears, too
200
-
201
- // Do not give minus points if a normal publishing year is found in normal years
202
- const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));
203
- const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));
99
+ const bNormalInANormal = a.normalYears.filter((aValue) => b.normalYears.some((bValue) => aValue === bValue));
100
+ const aNormalInBNormal = b.normalYears.filter((bValue) => a.normalYears.some((aValue) => bValue === aValue));
204
101
  debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);
205
102
  debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);
206
103
  if (bNormalInANormal > 0 || aNormalInBNormal > 0) {
207
104
  return 0;
208
105
  }
209
-
210
- // Do not give minus points if a normal publishing year is found in reprint years
211
- const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));
212
- const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));
106
+ const bNormalInAReprint = a.reprintYears.filter((aValue) => b.normalYears.some((bValue) => aValue === bValue));
107
+ const aNormalInBReprint = b.reprintYears.filter((bValue) => a.normalYears.some((aValue) => bValue === aValue));
213
108
  debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);
214
109
  debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);
215
110
  if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {
@@ -217,40 +112,5 @@ var _default = () => ({
217
112
  }
218
113
  return -1;
219
114
  }
220
- }); // https://www.loc.gov/marc/bibliographic/bd008.html
221
- // field 008
222
- // 06 - Type of date/Publication status
223
- // 07-10 - Date 1
224
- // 11-14 - Date 2
225
- //
226
- // 06 - Type of date/Publication status
227
- // b - No dates given; B.C. date involved
228
- // c - Continuing resource currently published
229
- // d - Continuing resource ceased publication
230
- // e - Detailed date
231
- // i - Inclusive dates of collection
232
- // k - Range of years of bulk of collection
233
- // m - Multiple dates
234
- // n - Dates unknown
235
- // p - Date of distribution/release/issue and production/recording session when different
236
- // q - Questionable date
237
- // r - Reprint/reissue date and original date
238
- // s - Single known date/probable date
239
- // t - Publication date and copyright date
240
- // u - Continuing resource status unknown
241
- // | - No attempt to code
242
- //
243
- // 07-10 - Date 1
244
- // 1-9 - Date digit
245
- // # - Date element is not applicable
246
- // u - Date element is totally or partially unknown
247
- // |||| - No attempt to code
248
- //
249
- // 11-14 - Date 2
250
- // 1-9 - Date digit
251
- // # - Date element is not applicable
252
- // u - Date element is totally or partially unknown
253
- // |||| - No attempt to code
254
- //
255
- exports.default = _default;
256
- //# sourceMappingURL=publication-time-allow-cons-years-multi.js.map
115
+ });
116
+ //# sourceMappingURL=publication-time-allow-cons-years-multi.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"publication-time-allow-cons-years-multi.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","recordExternal","debug","createDebugLogger","label","f008Values","extractF008Values","JSON","stringify","f26xValues","extractF26xValues","f500Values","extractF500Years","normalYears","Set","concat","f008Date1","filter","value","sort","copyrightYears","reprintYears","combined","get","undefined","testStringOrNumber","extractF008Date1","f008Date2","extractF008Date2","f008YearType","extractF008YearType","String","slice","copyrightRegex","pubNormalSubFieldValues","extractPubNormalSubfieldValues","pubF264CopySubFieldValues","extractPubF264CopySubfieldValues","pubF260CopySubFieldValues","extractPubF260CopySubfieldValues","field","tag","ind2","map","subfields","flat","code","test","removeNonAlphaNumeric","replace","nonAlphaNumericRegex","reprintRegex","reprintFieldContents","filteredF500","content","match","extractReprintYears","contents","yearRegex","years","uniqYears","compare","a","b","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","bNormalInANormal","aValue","some","bValue","aNormalInBNormal","bNormalInAReprint","aNormalInBReprint","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years-multi.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We should also get publishing time type from f008\n// We should get reprint times from f500 $a \"Lisäpainos/Lisäpainokset:\"\n\nexport default () => ({\n name: 'Publication time, allow consequent years, years from multiple sources',\n extract: ({record, recordExternal}) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const f008Values = extractF008Values(record);\n debug(`${label} f008: ${JSON.stringify(f008Values)}`);\n\n const f26xValues = extractF26xValues(record);\n debug(`${label} f26x: ${JSON.stringify(f26xValues)}`);\n\n const f500Values = extractF500Years(record);\n debug(`${label} f500: ${JSON.stringify(f500Values)}`);\n\n // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'\n // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?\n // We should handle unknown years (here or comparison?)\n // We should handle year ranges for continuing resources / collections\n\n const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();\n const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();\n const reprintYears = [...new Set(f500Values)].sort();\n\n const combined = {normalYears, copyrightYears, reprintYears};\n\n debug(`Combined: ${JSON.stringify(combined)}`);\n\n return combined;\n\n function extractF008Values(record) {\n // Record should have only one f008 - in case of several, we handle the first one\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n if (value && testStringOrNumber(value)) {\n const f008Date1 = extractF008Date1(value);\n const f008Date2 = extractF008Date2(value);\n const f008YearType = extractF008YearType(value);\n return {f008Date1, f008Date2, f008YearType};\n }\n return {f008Date1: undefined, f008Date2: undefined, f008YearType: undefined};\n\n function extractF008Date1(value) {\n return String(value).slice(7, 11);\n }\n\n function extractF008Date2(value) {\n return String(value).slice(11, 15);\n }\n\n function extractF008YearType(value) {\n return String(value).slice(6, 7);\n }\n }\n\n function extractF26xValues(record) {\n const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|©|p|℗)/u;\n\n const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);\n debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);\n\n const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);\n debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);\n\n const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);\n debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);\n\n return {normalYears: pubNormalSubFieldValues, copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]};\n\n function extractPubNormalSubfieldValues(record, copyrightRegex) {\n return record.get(/^26[04]$/u)\n .filter((field) => !(field.tag === '264' && field.ind2 === '4'))\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && !copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF264CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^264$/u)\n .filter((field) => field.ind2 === '4')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value)\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF260CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^260$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function removeNonAlphaNumeric(value) {\n debug(`Cleaning: ${JSON.stringify(value)}`);\n const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;\n return value ? value.replace(nonAlphaNumericRegex, '') : value;\n }\n }\n\n function extractF500Years(record) {\n\n const reprintRegex = /(?<reprint>Lisäpainokset:|Lisäpainos:)/u;\n const reprintFieldContents = record.get(/^500$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a')\n .map(({value}) => value);\n //.filter(value => value.test(reprintRegex));\n\n debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);\n\n const filteredF500 = reprintFieldContents.filter((content) => content && content.match(reprintRegex));\n\n debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);\n\n const reprintYears = extractReprintYears(filteredF500);\n\n return reprintYears;\n }\n\n function extractReprintYears(contents) {\n const yearRegex = /[0-9][0-9][0-9][0-9]/gu;\n const years = contents.map(content => content.match(yearRegex))\n .flat();\n debug(`${JSON.stringify(years)}`);\n const uniqYears = [...new Set(years)].sort();\n debug(`${JSON.stringify(uniqYears)}`);\n return uniqYears;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);\n\n const [firstA] = a.normalYears ? a.normalYears : a;\n const [firstB] = b.normalYears ? b.normalYears : b;\n\n debug(`Comparing ${JSON.stringify(firstA)} to ${JSON.stringify(firstB)}`);\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n if (!(isNaN(firstANumber) || isNaN(firstBNumber)) &&\n (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {\n return 0.1;\n }\n\n // We should do something with copyrightYears, too\n\n // Do not give minus points if a normal publishing year is found in normal years\n const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);\n debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);\n\n if (bNormalInANormal > 0 || aNormalInBNormal > 0) {\n return 0;\n }\n\n // Do not give minus points if a normal publishing year is found in reprint years\n const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);\n debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);\n\n if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {\n return 0;\n }\n\n return -1;\n\n }\n});\n\n// https://www.loc.gov/marc/bibliographic/bd008.html\n// field 008\n// 06 - Type of date/Publication status\n// 07-10 - Date 1\n// 11-14 - Date 2\n//\n// 06 - Type of date/Publication status\n// b - No dates given; B.C. date involved\n// c - Continuing resource currently published\n// d - Continuing resource ceased publication\n// e - Detailed date\n// i - Inclusive dates of collection\n// k - Range of years of bulk of collection\n// m - Multiple dates\n// n - Dates unknown\n// p - Date of distribution/release/issue and production/recording session when different\n// q - Questionable date\n// r - Reprint/reissue date and original date\n// s - Single known date/probable date\n// t - Publication date and copyright date\n// u - Continuing resource status unknown\n// | - No attempt to code\n//\n// 07-10 - Date 1\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n// 11-14 - Date 2\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n\n"],"mappings":";;;;;;AA4BA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA7BtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AAAA,IAAAG,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,uEAAuE;EAC7EC,OAAO,EAAEA,CAAC;IAACC,MAAM;IAAEC;EAAc,CAAC,KAAK;IACrC,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,wGAAwG,CAAC;IACzI,MAAMC,KAAK,GAAGH,cAAc,IAAIA,cAAc,CAACG,KAAK,GAAGH,cAAc,CAACG,KAAK,GAAG,QAAQ;IAEtF,MAAMC,UAAU,GAAGC,iBAAiB,CAACN,MAAM,CAAC;IAC5CE,KAAK,CAAE,GAAEE,KAAM,UAASG,IAAI,CAACC,SAAS,CAACH,UAAU,CAAE,EAAC,CAAC;IAErD,MAAMI,UAAU,GAAGC,iBAAiB,CAACV,MAAM,CAAC;IAC5CE,KAAK,CAAE,GAAEE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,CAACC,SAAS,CAAC8D,gBAAgB,CAAE,EAAC,CAAC;IAC5DpE,KAAK,CAAE,mBAAkBK,IAAI,CAACC,SAAS,CAACkE,gBAAgB,CAAE,EAAC,CAAC;IAE5D,IAAIJ,gBAAgB,GAAG,CAAC,IAAII,gBAAgB,GAAG,CAAC,EAAE;MAChD,OAAO,CAAC;IACV;;IAEA;IACA,MAAMC,iBAAiB,GAAGb,CAAC,CAACzC,YAAY,CAACJ,MAAM,CAACsD,MAAM,IAAIR,CAAC,CAAClD,WAAW,CAAC2D,IAAI,CAACC,MAAM,IAAIF,MAAM,KAAKE,MAAM,CAAC,CAAC;IAC1G,MAAMG,iBAAiB,GAAGb,CAAC,CAAC1C,YAAY,CAACJ,MAAM,CAACwD,MAAM,IAAIX,CAAC,CAACjD,WAAW,CAAC2D,IAAI,CAACD,MAAM,IAAIE,MAAM,KAAKF,MAAM,CAAC,CAAC;IAC1GrE,KAAK,CAAE,sBAAqBK,IAAI,CAACC,SAAS,CAACmE,iBAAiB,CAAE,EAAC,CAAC;IAChEzE,KAAK,CAAE,sBAAqBK,IAAI,CAACC,SAAS,CAACoE,iBAAiB,CAAE,EAAC,CAAC;IAEhE,IAAID,iBAAiB,GAAG,CAAC,IAAIC,iBAAiB,GAAG,CAAC,EAAE;MAClD,OAAO,CAAC;IACV;IAEA,OAAO,CAAC,CAAC;EAEX;AACF,CAAC,CAAC,EAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAAC,OAAA,CAAAjF,OAAA,GAAAC,QAAA"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/match-detection/features/bib/publication-time-allow-cons-years-multi.js"],
4
+ "sourcesContent": ["\nimport createDebugLogger from 'debug';\nimport {testStringOrNumber} from '../../../matching-utils.js';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We should also get publishing time type from f008\n// We should get reprint times from f500 $a \"Lis\u00E4painos/Lis\u00E4painokset:\"\n\nexport default () => ({\n name: 'Publication time, allow consequent years, years from multiple sources',\n extract: ({record, recordExternal}) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const f008Values = extractF008Values(record);\n debug(`${label}: f008: ${JSON.stringify(f008Values)}`);\n\n const f26xValues = extractF26xValues(record);\n debug(`${label}: f26x: ${JSON.stringify(f26xValues)}`);\n\n const f500Values = extractF500Years(record);\n debug(`${label}: f500: ${JSON.stringify(f500Values)}`);\n\n // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'\n // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?\n // We should handle unknown years (here or comparison?)\n // We should handle year ranges for continuing resources / collections\n\n const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();\n const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();\n const reprintYears = [...new Set(f500Values)].sort();\n\n const combined = {normalYears, copyrightYears, reprintYears};\n\n debug(`Combined: ${JSON.stringify(combined)}`);\n\n return combined;\n\n function extractF008Values(record) {\n // Record should have only one f008 - in case of several, we handle the first one\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n if (value && testStringOrNumber(value)) {\n const f008Date1 = extractF008Date1(value);\n const f008Date2 = extractF008Date2(value);\n const f008YearType = extractF008YearType(value);\n return {f008Date1, f008Date2, f008YearType};\n }\n return {f008Date1: undefined, f008Date2: undefined, f008YearType: undefined};\n\n function extractF008Date1(value) {\n return String(value).slice(7, 11);\n }\n\n function extractF008Date2(value) {\n return String(value).slice(11, 15);\n }\n\n function extractF008YearType(value) {\n return String(value).slice(6, 7);\n }\n }\n\n function extractF26xValues(record) {\n const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|\u00A9|p|\u2117)/u;\n\n const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);\n debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);\n\n const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);\n debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);\n\n const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);\n debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);\n\n return {normalYears: pubNormalSubFieldValues, copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]};\n\n function extractPubNormalSubfieldValues(record, copyrightRegex) {\n return record.get(/^26[04]$/u)\n .filter((field) => !(field.tag === '264' && field.ind2 === '4'))\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && !copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF264CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^264$/u)\n .filter((field) => field.ind2 === '4')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value)\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF260CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^260$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function removeNonAlphaNumeric(value) {\n debug(`Cleaning: ${JSON.stringify(value)}`);\n const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;\n return value ? value.replace(nonAlphaNumericRegex, '') : value;\n }\n }\n\n function extractF500Years(record) {\n\n const reprintRegex = /(?<reprint>Lis\u00E4painokset:|Lis\u00E4painos:)/u;\n const reprintFieldContents = record.get(/^500$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a')\n .map(({value}) => value);\n //.filter(value => value.test(reprintRegex));\n\n debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);\n\n const filteredF500 = reprintFieldContents.filter((content) => content && content.match(reprintRegex));\n\n debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);\n\n const reprintYears = extractReprintYears(filteredF500);\n\n return reprintYears;\n }\n\n function extractReprintYears(contents) {\n const yearRegex = /[0-9][0-9][0-9][0-9]/gu;\n const years = contents.map(content => content.match(yearRegex))\n .flat();\n debug(`${JSON.stringify(years)}`);\n const uniqYears = [...new Set(years)].sort();\n debug(`${JSON.stringify(uniqYears)}`);\n return uniqYears;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);\n\n const [firstA] = a.normalYears ? a.normalYears : a;\n const [firstB] = b.normalYears ? b.normalYears : b;\n\n debug(`Comparing ${JSON.stringify(firstA)} to ${JSON.stringify(firstB)}`);\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n if (!(isNaN(firstANumber) || isNaN(firstBNumber)) &&\n (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {\n return 0.1;\n }\n\n // We should do something with copyrightYears, too\n\n // Do not give minus points if a normal publishing year is found in normal years\n const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);\n debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);\n\n if (bNormalInANormal > 0 || aNormalInBNormal > 0) {\n return 0;\n }\n\n // Do not give minus points if a normal publishing year is found in reprint years\n const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);\n debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);\n\n if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {\n return 0;\n }\n\n return -1;\n\n }\n});\n\n// https://www.loc.gov/marc/bibliographic/bd008.html\n// field 008\n// 06 - Type of date/Publication status\n// 07-10 - Date 1\n// 11-14 - Date 2\n//\n// 06 - Type of date/Publication status\n// b - No dates given; B.C. date involved\n// c - Continuing resource currently published\n// d - Continuing resource ceased publication\n// e - Detailed date\n// i - Inclusive dates of collection\n// k - Range of years of bulk of collection\n// m - Multiple dates\n// n - Dates unknown\n// p - Date of distribution/release/issue and production/recording session when different\n// q - Questionable date\n// r - Reprint/reissue date and original date\n// s - Single known date/probable date\n// t - Publication date and copyright date\n// u - Continuing resource status unknown\n// | - No attempt to code\n//\n// 07-10 - Date 1\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n// 11-14 - Date 2\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n\n"],
5
+ "mappings": "AACA,OAAO,uBAAuB;AAC9B,SAAQ,0BAAyB;AAMjC,eAAe,OAAO;AAAA,EACpB,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,QAAQ,eAAc,MAAM;AACrC,UAAM,QAAQ,kBAAkB,wG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gB,CAAC,EAAE;AAE3D,QAAI,mBAAmB,KAAK,mBAAmB,GAAG;AAChD,aAAO;AAAA,IACT;AAGA,UAAM,oBAAoB,EAAE,aAAa,OAAO,YAAU,EAAE,YAAY,KAAK,YAAU,WAAW,MAAM,CAAC;AACzG,UAAM,oBAAoB,EAAE,aAAa,OAAO,YAAU,EAAE,YAAY,KAAK,YAAU,WAAW,MAAM,CAAC;AACzG,UAAM,sBAAsB,KAAK,UAAU,iBAAiB,CAAC,EAAE;AAC/D,UAAM,sBAAsB,KAAK,UAAU,iBAAiB,CAAC,EAAE;AAE/D,QAAI,oBAAoB,KAAK,oBAAoB,GAAG;AAClD,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EAET;AACF;",
6
+ "names": ["record", "value", "copyrightRegex", "reprintYears"]
7
+ }
@@ -1,59 +1,20 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _matchingUtils = require("../../../matching-utils");
8
- var _debug = _interopRequireDefault(require("debug"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- /**
11
- *
12
- * @licstart The following is the entire license notice for the JavaScript code in this file.
13
- *
14
- * Melinda record matching modules for Javascript
15
- *
16
- * Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)
17
- *
18
- * This file is part of melinda-record-matching-js
19
- *
20
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
21
- * it under the terms of the GNU Lesser General Public License as
22
- * published by the Free Software Foundation, either version 3 of the
23
- * License, or (at your option) any later version.
24
- *
25
- * melinda-record-matching-js is distributed in the hope that it will be useful,
26
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
- * GNU Lesser General Public License for more details.
29
- *
30
- * You should have received a copy of the GNU Affero General Public License
31
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
- *
33
- * @licend The above is the entire license notice
34
- * for the JavaScript code in this file.
35
- *
36
- */
37
- // We should also get copyright time and copyright/publication times from 26x
38
- var _default = () => ({
39
- name: 'Publication time, allow consequent years',
40
- extract: ({
41
- record
42
- }) => {
43
- const value = record.get(/^008$/u)?.[0]?.value || undefined;
44
- return (0, _matchingUtils.testStringOrNumber)(value) ? [String(value).slice(7, 11)] : [];
1
+ import createDebugLogger from "debug";
2
+ import { testStringOrNumber } from "../../../matching-utils.js";
3
+ export default () => ({
4
+ name: "Publication time, allow consequent years",
5
+ extract: ({ record }) => {
6
+ const value = record.get(/^008$/u)?.[0]?.value || void 0;
7
+ return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];
45
8
  },
46
9
  compare: (a, b) => {
47
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years');
10
+ const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years");
48
11
  debug(`Comparing ${a[0]} to ${b[0]}`);
49
12
  const [firstA] = a;
50
13
  const [firstB] = b;
51
14
  if (firstA === firstB) {
52
15
  return 0.1;
53
16
  }
54
-
55
- // If either of years is a non string/number, values are not comparable
56
- if (!(0, _matchingUtils.testStringOrNumber)(firstA) || !(0, _matchingUtils.testStringOrNumber)(firstB)) {
17
+ if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {
57
18
  return 0;
58
19
  }
59
20
  const firstANumber = parseInt(firstA, 10);
@@ -61,11 +22,7 @@ var _default = () => ({
61
22
  if (isNaN(firstANumber) || isNaN(firstBNumber)) {
62
23
  return -1;
63
24
  }
64
-
65
- // Handle consequent years as a match
66
- // see publication-time for a version that does not handle consequent years as a match
67
25
  return firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber ? 0.1 : -1;
68
26
  }
69
27
  });
70
- exports.default = _default;
71
- //# sourceMappingURL=publication-time-allow-cons-years.js.map
28
+ //# sourceMappingURL=publication-time-allow-cons-years.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"publication-time-allow-cons-years.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","debug","createDebugLogger","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n\nexport default () => ({\n name: 'Publication time, allow consequent years',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years');\n debug(`Comparing ${a[0]} to ${b[0]}`);\n\n const [firstA] = a;\n const [firstB] = b;\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n if (isNaN(firstANumber) || isNaN(firstBNumber)) {\n return -1;\n }\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n return firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber ? 0.1 : -1;\n }\n});\n"],"mappings":";;;;;;AA4BA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA7BtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AAAA,IAAAG,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,0CAA0C;EAChDC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAK;IACrB,MAAMC,KAAK,GAAGD,MAAM,CAACE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAED,KAAK,IAAIE,SAAS;IAC3D,OAAO,IAAAC,iCAAkB,EAACH,KAAK,CAAC,GAAG,CAACI,MAAM,CAACJ,KAAK,CAAC,CAACK,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE;EACtE,CAAC;EACDC,OAAO,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAK;IACjB,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,kGAAkG,CAAC;IACnID,KAAK,CAAE,aAAYF,CAAC,CAAC,CAAC,CAAE,OAAMC,CAAC,CAAC,CAAC,CAAE,EAAC,CAAC;IAErC,MAAM,CAACG,MAAM,CAAC,GAAGJ,CAAC;IAClB,MAAM,CAACK,MAAM,CAAC,GAAGJ,CAAC;IAElB,IAAIG,MAAM,KAAKC,MAAM,EAAE;MACrB,OAAO,GAAG;IACZ;;IAEA;IACA,IAAI,CAAC,IAAAT,iCAAkB,EAACQ,MAAM,CAAC,IAAI,CAAC,IAAAR,iCAAkB,EAACS,MAAM,CAAC,EAAE;MAC9D,OAAO,CAAC;IACV;IAEA,MAAMC,YAAY,GAAGC,QAAQ,CAACH,MAAM,EAAE,EAAE,CAAC;IACzC,MAAMI,YAAY,GAAGD,QAAQ,CAACF,MAAM,EAAE,EAAE,CAAC;IAEzC,IAAII,KAAK,CAACH,YAAY,CAAC,IAAIG,KAAK,CAACD,YAAY,CAAC,EAAE;MAC9C,OAAO,CAAC,CAAC;IACX;;IAEA;IACA;IACA,OAAOF,YAAY,GAAG,CAAC,KAAKE,YAAY,IAAIF,YAAY,GAAG,CAAC,KAAKE,YAAY,GAAG,GAAG,GAAG,CAAC,CAAC;EAC1F;AACF,CAAC,CAAC;AAAAE,OAAA,CAAAtB,OAAA,GAAAC,QAAA"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/match-detection/features/bib/publication-time-allow-cons-years.js"],
4
+ "sourcesContent": ["\nimport createDebugLogger from 'debug';\nimport {testStringOrNumber} from '../../../matching-utils.js';\n\n// We should also get copyright time and copyright/publication times from 26x\n\nexport default () => ({\n name: 'Publication time, allow consequent years',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years');\n debug(`Comparing ${a[0]} to ${b[0]}`);\n\n const [firstA] = a;\n const [firstB] = b;\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n if (isNaN(firstANumber) || isNaN(firstBNumber)) {\n return -1;\n }\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n return firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber ? 0.1 : -1;\n }\n});\n"],
5
+ "mappings": "AACA,OAAO,uBAAuB;AAC9B,SAAQ,0BAAyB;AAIjC,eAAe,OAAO;AAAA,EACpB,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACrB,UAAM,QAAQ,OAAO,IAAI,QAAQ,IAAI,CAAC,GAAG,SAAS;AAClD,WAAO,mBAAmB,KAAK,IAAI,CAAC,OAAO,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC;AAAA,EACrE;AAAA,EACA,SAAS,CAAC,GAAG,MAAM;AACjB,UAAM,QAAQ,kBAAkB,kGAAkG;AAClI,UAAM,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;AAEpC,UAAM,CAAC,MAAM,IAAI;AACjB,UAAM,CAAC,MAAM,IAAI;AAEjB,QAAI,WAAW,QAAQ;AACrB,aAAO;AAAA,IACT;AAGA,QAAI,CAAC,mBAAmB,MAAM,KAAK,CAAC,mBAAmB,MAAM,GAAG;AAC9D,aAAO;AAAA,IACT;AAEA,UAAM,eAAe,SAAS,QAAQ,EAAE;AACxC,UAAM,eAAe,SAAS,QAAQ,EAAE;AAExC,QAAI,MAAM,YAAY,KAAK,MAAM,YAAY,GAAG;AAC9C,aAAO;AAAA,IACT;AAIA,WAAO,eAAe,MAAM,gBAAgB,eAAe,MAAM,eAAe,MAAM;AAAA,EACxF;AACF;",
6
+ "names": []
7
+ }
@@ -1,48 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _matchingUtils = require("../../../matching-utils");
8
- /**
9
- *
10
- * @licstart The following is the entire license notice for the JavaScript code in this file.
11
- *
12
- * Melinda record matching modules for Javascript
13
- *
14
- * Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)
15
- *
16
- * This file is part of melinda-record-matching-js
17
- *
18
- * melinda-record-matching-js program 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
- * melinda-record-matching-js 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 Affero 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
- // We should also get copyright time and copyright/publication times from 26x
36
- // see publication-time-allow-cons-years for a version allowing consequent years to match
37
- var _default = () => ({
38
- name: 'Publication time',
39
- extract: ({
40
- record
41
- }) => {
42
- const value = record.get(/^008$/u)?.[0]?.value || undefined;
43
- return (0, _matchingUtils.testStringOrNumber)(value) ? [String(value).slice(7, 11)] : [];
1
+ import { testStringOrNumber } from "../../../matching-utils.js";
2
+ export default () => ({
3
+ name: "Publication time",
4
+ extract: ({ record }) => {
5
+ const value = record.get(/^008$/u)?.[0]?.value || void 0;
6
+ return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];
44
7
  },
45
- compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0
8
+ compare: (a, b) => a[0] === b[0] ? 0.1 : -1
46
9
  });
47
- exports.default = _default;
48
- //# sourceMappingURL=publication-time.js.map
10
+ //# sourceMappingURL=publication-time.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"publication-time.js","names":["_matchingUtils","require","_default","name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","exports","default"],"sources":["../../../../src/match-detection/features/bib/publication-time.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {testStringOrNumber} from '../../../matching-utils';\n\n// We should also get copyright time and copyright/publication times from 26x\n// see publication-time-allow-cons-years for a version allowing consequent years to match\n\nexport default () => ({\n name: 'Publication time',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"mappings":";;;;;;AA4BA,IAAAA,cAAA,GAAAC,OAAA;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAAA,IAAAC,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAK;IACrB,MAAMC,KAAK,GAAGD,MAAM,CAACE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAED,KAAK,IAAIE,SAAS;IAC3D,OAAO,IAAAC,iCAAkB,EAACH,KAAK,CAAC,GAAG,CAACI,MAAM,CAACJ,KAAK,CAAC,CAACK,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE;EACtE,CAAC;EACDC,OAAO,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAd,QAAA"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/match-detection/features/bib/publication-time.js"],
4
+ "sourcesContent": ["\n\nimport {testStringOrNumber} from '../../../matching-utils.js';\n\n// We should also get copyright time and copyright/publication times from 26x\n// see publication-time-allow-cons-years for a version allowing consequent years to match\n\nexport default () => ({\n name: 'Publication time',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],
5
+ "mappings": "AAEA,SAAQ,0BAAyB;AAKjC,eAAe,OAAO;AAAA,EACpB,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACrB,UAAM,QAAQ,OAAO,IAAI,QAAQ,IAAI,CAAC,GAAG,SAAS;AAClD,WAAO,mBAAmB,KAAK,IAAI,CAAC,OAAO,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC;AAAA,EACrE;AAAA,EACA,SAAS,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,MAAM;AAC3C;",
6
+ "names": []
7
+ }
@@ -1,45 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- *
9
- * @licstart The following is the entire license notice for the JavaScript code in this file.
10
- *
11
- * Melinda record matching modules for Javascript
12
- *
13
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
14
- *
15
- * This file is part of melinda-record-matching-js
16
- *
17
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
18
- * it under the terms of the GNU Lesser General Public License as
19
- * published by the Free Software Foundation, either version 3 of the
20
- * License, or (at your option) any later version.
21
- *
22
- * melinda-record-matching-js is distributed in the hope that it will be useful,
23
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
- * GNU Lesser General Public License for more details.
26
- *
27
- * You should have received a copy of the GNU Affero General Public License
28
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
29
- *
30
- * @licend The above is the entire license notice
31
- * for the JavaScript code in this file.
32
- *
33
- */
34
- // we could handle the case of books/notes
35
- // Recordtype: LDR/06 - Type of Record
36
- // Note: currently matchValidator fails all mismatching recordTypes, so this won't actually do much
37
- var _default = () => ({
38
- name: 'Record type',
39
- extract: ({
40
- record
41
- }) => record.leader[6] ? [record.leader[6]] : [],
1
+ export default () => ({
2
+ name: "Record type",
3
+ extract: ({ record }) => record.leader[6] ? [record.leader[6]] : [],
42
4
  compare: (a, b) => a[0] === b[0] ? 0.1 : -0.5
43
5
  });
44
- exports.default = _default;
45
- //# sourceMappingURL=record-type.js.map
6
+ //# sourceMappingURL=record-type.js.map