@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.
Files changed (139) hide show
  1. package/.github/CODEOWNERS +10 -0
  2. package/.github/dependabot.yml +40 -0
  3. package/.github/workflows/melinda-node-tests.yml +61 -0
  4. package/LICENSE.txt +21 -165
  5. package/README.md +1 -1
  6. package/dist/access-rights.js +0 -27
  7. package/dist/access-rights.js.map +1 -1
  8. package/dist/access-rights.spec.js +0 -27
  9. package/dist/access-rights.spec.js.map +1 -1
  10. package/dist/double-commas.js +0 -27
  11. package/dist/double-commas.js.map +1 -1
  12. package/dist/double-commas.spec.js +0 -27
  13. package/dist/double-commas.spec.js.map +1 -1
  14. package/dist/duplicates-ind1.js +0 -27
  15. package/dist/duplicates-ind1.js.map +1 -1
  16. package/dist/duplicates-ind1.spec.js +0 -27
  17. package/dist/duplicates-ind1.spec.js.map +1 -1
  18. package/dist/empty-fields.js +0 -28
  19. package/dist/empty-fields.js.map +1 -1
  20. package/dist/empty-fields.spec.js +0 -27
  21. package/dist/empty-fields.spec.js.map +1 -1
  22. package/dist/ending-punctuation-conf.js +0 -28
  23. package/dist/ending-punctuation-conf.js.map +1 -1
  24. package/dist/ending-punctuation.js.map +1 -1
  25. package/dist/ending-punctuation.spec.js +0 -27
  26. package/dist/ending-punctuation.spec.js.map +1 -1
  27. package/dist/field-exclusion.js +0 -28
  28. package/dist/field-exclusion.js.map +1 -1
  29. package/dist/field-exclusion.spec.js +0 -27
  30. package/dist/field-exclusion.spec.js.map +1 -1
  31. package/dist/field-structure.js +0 -28
  32. package/dist/field-structure.js.map +1 -1
  33. package/dist/field-structure.spec.js +0 -27
  34. package/dist/field-structure.spec.js.map +1 -1
  35. package/dist/fields-present.js +0 -27
  36. package/dist/fields-present.js.map +1 -1
  37. package/dist/fields-present.spec.js +0 -27
  38. package/dist/fields-present.spec.js.map +1 -1
  39. package/dist/fixed-fields.js +0 -27
  40. package/dist/fixed-fields.js.map +1 -1
  41. package/dist/fixed-fields.spec.js +0 -27
  42. package/dist/fixed-fields.spec.js.map +1 -1
  43. package/dist/identical-fields.js +0 -28
  44. package/dist/identical-fields.js.map +1 -1
  45. package/dist/identical-fields.spec.js +0 -27
  46. package/dist/identical-fields.spec.js.map +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/isbn-issn.js +0 -27
  49. package/dist/isbn-issn.js.map +1 -1
  50. package/dist/isbn-issn.spec.js +0 -27
  51. package/dist/isbn-issn.spec.js.map +1 -1
  52. package/dist/item-language.js +0 -27
  53. package/dist/item-language.js.map +1 -1
  54. package/dist/item-language.spec.js +0 -27
  55. package/dist/item-language.spec.js.map +1 -1
  56. package/dist/punctuation/index.js +21 -1
  57. package/dist/punctuation/index.js.map +1 -1
  58. package/dist/punctuation/rules/aut.js.map +1 -1
  59. package/dist/punctuation/rules/bib.js +8 -1
  60. package/dist/punctuation/rules/bib.js.map +1 -1
  61. package/dist/punctuation/rules/index.js.map +1 -1
  62. package/dist/punctuation.spec.js +49 -140
  63. package/dist/punctuation.spec.js.map +1 -1
  64. package/dist/resolvable-ext-references-melinda.js +0 -27
  65. package/dist/resolvable-ext-references-melinda.js.map +1 -1
  66. package/dist/resolvable-ext-references-melinda.spec.js +3 -29
  67. package/dist/resolvable-ext-references-melinda.spec.js.map +1 -1
  68. package/dist/sort-tags.js +0 -27
  69. package/dist/sort-tags.js.map +1 -1
  70. package/dist/sort-tags.spec.js +0 -27
  71. package/dist/sort-tags.spec.js.map +1 -1
  72. package/dist/subfield-exclusion.js +0 -28
  73. package/dist/subfield-exclusion.js.map +1 -1
  74. package/dist/subfield-exclusion.spec.js +0 -27
  75. package/dist/subfield-exclusion.spec.js.map +1 -1
  76. package/dist/unicode-decomposition.js +0 -28
  77. package/dist/unicode-decomposition.js.map +1 -1
  78. package/dist/unicode-decomposition.spec.js +0 -27
  79. package/dist/unicode-decomposition.spec.js.map +1 -1
  80. package/dist/urn.js +0 -27
  81. package/dist/urn.js.map +1 -1
  82. package/dist/urn.spec.js +0 -27
  83. package/dist/urn.spec.js.map +1 -1
  84. package/package.json +5 -3
  85. package/src/access-rights.js +0 -29
  86. package/src/access-rights.spec.js +0 -29
  87. package/src/double-commas.js +0 -29
  88. package/src/double-commas.spec.js +0 -29
  89. package/src/duplicates-ind1.js +0 -29
  90. package/src/duplicates-ind1.spec.js +0 -29
  91. package/src/empty-fields.js +0 -28
  92. package/src/empty-fields.spec.js +0 -29
  93. package/src/ending-punctuation-conf.js +0 -29
  94. package/src/ending-punctuation.spec.js +0 -29
  95. package/src/field-exclusion.js +0 -29
  96. package/src/field-exclusion.spec.js +0 -29
  97. package/src/field-structure.js +0 -29
  98. package/src/field-structure.spec.js +0 -29
  99. package/src/fields-present.js +0 -29
  100. package/src/fields-present.spec.js +0 -29
  101. package/src/fixed-fields.js +0 -29
  102. package/src/fixed-fields.spec.js +0 -29
  103. package/src/identical-fields.js +0 -28
  104. package/src/identical-fields.spec.js +0 -29
  105. package/src/index.js +0 -29
  106. package/src/isbn-issn.js +0 -28
  107. package/src/isbn-issn.spec.js +0 -29
  108. package/src/item-language.js +0 -29
  109. package/src/item-language.spec.js +0 -29
  110. package/src/punctuation/index.js +19 -1
  111. package/src/punctuation/rules/bib.js +9 -1
  112. package/src/punctuation.spec.js +48 -147
  113. package/src/resolvable-ext-references-melinda.js +0 -28
  114. package/src/resolvable-ext-references-melinda.spec.js +2 -30
  115. package/src/sort-tags.js +0 -29
  116. package/src/sort-tags.spec.js +0 -29
  117. package/src/subfield-exclusion.js +0 -29
  118. package/src/subfield-exclusion.spec.js +0 -29
  119. package/src/unicode-decomposition.js +0 -28
  120. package/src/unicode-decomposition.spec.js +0 -29
  121. package/src/urn.js +0 -29
  122. package/src/urn.spec.js +0 -29
  123. package/test-fixtures/punctuation/01/expectedResult.json +3 -0
  124. package/test-fixtures/punctuation/01/metadata.json +4 -0
  125. package/test-fixtures/punctuation/01/record.json +18 -0
  126. package/test-fixtures/punctuation/02/expectedResult.json +3 -0
  127. package/test-fixtures/punctuation/02/metadata.json +4 -0
  128. package/test-fixtures/punctuation/02/record.json +18 -0
  129. package/test-fixtures/punctuation/03/expectedResult.json +21 -0
  130. package/test-fixtures/punctuation/03/metadata.json +5 -0
  131. package/test-fixtures/punctuation/03/record.json +19 -0
  132. package/test-fixtures/punctuation/04/expectedResult.json +21 -0
  133. package/test-fixtures/punctuation/04/metadata.json +5 -0
  134. package/test-fixtures/punctuation/04/record.json +19 -0
  135. package/test-fixtures/punctuation/05/expectedResult.json +44 -0
  136. package/test-fixtures/punctuation/05/metadata.json +5 -0
  137. package/test-fixtures/punctuation/05/record.json +42 -0
  138. package/test-fixtures/resolvable-ext-references-melinda.js +0 -27
  139. package/.drone.yml +0 -93
@@ -0,0 +1,10 @@
1
+ # With this line @NatLibFi/melinda-js-lead owns any files in the /.github/
2
+ # directory at the root of the repository and any of its
3
+ # subdirectories.
4
+ /.github/ @NatLibFi/melinda-js-lead
5
+
6
+
7
+ # With this line @NatLibFi/melinda-js-lead owns any files in the /src/
8
+ # directory at the root of the repository and any of its
9
+ # subdirectories.
10
+ /src/ @NatLibFi/melinda-js-lead
@@ -0,0 +1,40 @@
1
+ # NatLibFi/Melinda maintenance strategy
2
+ # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
3
+
4
+ version: 2
5
+ updates:
6
+ # Maintain dependencies for GitHub Actions
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
11
+ time: "06:30"
12
+ timezone: "Europe/Helsinki"
13
+
14
+ # Minor updates to npm production dependencies daily
15
+ - package-ecosystem: "npm"
16
+ directory: "/"
17
+ schedule:
18
+ interval: "daily"
19
+ time: "06:45"
20
+ timezone: "Europe/Helsinki"
21
+ versioning-strategy: lockfile-only
22
+ labels:
23
+ - "npm minor dependencies"
24
+ allow:
25
+ - dependency-type: "production"
26
+
27
+ # Major updates to npm dependencies weekly @tuesday
28
+ # Not possible yet https://github.com/dependabot/dependabot-core/issues/1778
29
+ # - package-ecosystem: "npm"
30
+ # directory: "/"
31
+ # schedule:
32
+ # interval: "weekly"
33
+ # day: "tuesday"
34
+ # time: "07:00"
35
+ # timezone: "Europe/Helsinki"
36
+ # versioning-strategy: increase-if-necessary
37
+ # labels:
38
+ # - "npm major dependencies"
39
+ # reviewers:
40
+ # - "natlibfi/melinda-js-lead"
@@ -0,0 +1,61 @@
1
+ # Melinda node tests
2
+
3
+ name: Melinda-node-tests
4
+
5
+ on: push
6
+
7
+ jobs:
8
+ build-node-versions:
9
+ name: Node version matrix
10
+ runs-on: ubuntu-latest
11
+
12
+ strategy:
13
+ matrix:
14
+ node-version: [12.x, 14.x, 16.x, 18.x]
15
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
16
+
17
+ steps:
18
+ - name: Checkout the code
19
+ uses: actions/checkout@v3
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v2
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'npm'
25
+ env:
26
+ NPM_CONFIG_IGNORE_SCRIPTS: true
27
+ - run: npm audit --package-lock-only --production --audit-level=moderate
28
+ - run: npm ci
29
+ - run: npm test
30
+ - run: npm run build --if-present
31
+
32
+ njsscan:
33
+ name: Njsscan-check
34
+ runs-on: ubuntu-latest
35
+ container: docker://node:14
36
+
37
+ steps:
38
+ - name: Checkout the code
39
+ uses: actions/checkout@v3
40
+ - name: nodejsscan scan
41
+ id: njsscan
42
+ uses: ajinabraham/njsscan-action@master
43
+ with:
44
+ args: '.'
45
+
46
+ publish-to-npm:
47
+ runs-on: ubuntu-latest
48
+ needs: [build-node-versions, njsscan]
49
+ if: contains(github.ref, 'refs/tags/')
50
+
51
+ steps:
52
+ - uses: actions/checkout@v3
53
+ # Setup .npmrc file to publish to npm
54
+ - uses: actions/setup-node@v2
55
+ with:
56
+ node-version: '14.x'
57
+ registry-url: 'https://registry.npmjs.org'
58
+ - run: npm ci
59
+ - run: npm publish
60
+ env:
61
+ NODE_AUTH_TOKEN: ${{ secrets.MARC_RECORD_VALIDATORS_MELINDA_NPM_TOKEN }}
package/LICENSE.txt CHANGED
@@ -1,165 +1,21 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
1
+ MIT License
2
+
3
+ Copyright (c) 2022-present University Of Helsinki (The National Library Of Finland)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -5,4 +5,4 @@ MARC record validators used in Melinda. See [wiki](https://github.com/NatLibFi/m
5
5
 
6
6
  Copyright (c) 2014-2020 **University Of Helsinki (The National Library Of Finland)**
7
7
 
8
- This project's source code is licensed under the terms of **GNU Lesser General Public License Version 3** or any later version.
8
+ This project's source code is licensed under the terms of **MIT** or any later version.
@@ -5,33 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = _default;
7
7
 
8
- /**
9
- *
10
- * @licstart The following is the entire license notice for the JavaScript code in this file.
11
- *
12
- * MARC record validators used in Melinda
13
- *
14
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
15
- *
16
- * This file is part of marc-record-validators-melinda
17
- *
18
- * marc-record-validators-melinda 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
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
24
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- * GNU Lesser General Public License for more details.
27
- *
28
- * You should have received a copy of the GNU Lesser General Public License
29
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
30
- *
31
- * @licend The above is the entire license notice
32
- * for the JavaScript code in this file.
33
- *
34
- */
35
8
  function _default() {
36
9
  const sf506 = [{
37
10
  code: 'a',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/access-rights.js"],"names":["sf506","code","value","sf540","fix","record","hasTag","insertField","tag","ind1","subfields","validate","valid","description","rec","sfcv","fields","some","f","every","sf","test"],"mappings":";;;;;;;AAAA;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;AAGe,oBAAY;AACzB,QAAMA,KAAK,GAAG,CAAC;AAACC,IAAAA,IAAI,EAAE,GAAP;AAAYC,IAAAA,KAAK,EAAE;AAAnB,GAAD,CAAd;AACA,QAAMC,KAAK,GAAG,CAAC;AAACF,IAAAA,IAAI,EAAE,GAAP;AAAYC,IAAAA,KAAK,EAAE;AAAnB,GAAD,CAAd;;AAEA,WAASE,GAAT,CAAaC,MAAb,EAAqB;AACnB,QAAI,CAACC,MAAM,CAACD,MAAD,EAAS,KAAT,EAAgBL,KAAhB,CAAX,EAAmC;AAAE;AACnCK,MAAAA,MAAM,CAACE,WAAP,CAAmB;AACjBC,QAAAA,GAAG,EAAE,KADY;AAEjBC,QAAAA,IAAI,EAAE,GAFW;AAGjBC,QAAAA,SAAS,EAAE,CACT;AACET,UAAAA,IAAI,EAAE,GADR;AAEEC,UAAAA,KAAK,EAAE;AAFT,SADS,EAIN;AACDD,UAAAA,IAAI,EAAE,GADL;AAEDC,UAAAA,KAAK,EAAE;AAFN,SAJM,EAON;AACDD,UAAAA,IAAI,EAAE,GADL;AAEDC,UAAAA,KAAK,EAAE;AAFN,SAPM,EAUN;AACDD,UAAAA,I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CAAgBC,CAAC,IAAIA,CAAC,CAACV,GAAF,KAAUA,GAAV,IAAiBO,IAAI,CAACI,KAAL,CAAW,CAAC;AAAClB,MAAAA,IAAD;AAAOC,MAAAA;AAAP,KAAD,KAAmBgB,CAAC,CAACR,SAAF,CAAYO,IAAZ,CAAiBG,EAAE,IAAIA,EAAE,CAACnB,IAAH,KAAYA,IAAZ,IAAoBC,KAAK,CAACmB,IAAN,CAAWD,EAAE,CAAClB,KAAd,CAA3C,CAA9B,CAAtC,CAAP;AACD;AACF","sourcesContent":["/**\n *\n * @licstart The following is the entire license notice for the JavaScript code in this file.\n *\n * MARC record validators used in Melinda\n *\n * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)\n *\n * This file is part of marc-record-validators-melinda\n *\n * marc-record-validators-melinda 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 * marc-record-validators-melinda 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 Lesser 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\n\nexport default function () {\n const sf506 = [{code: 'a', value: /aineisto on käytettävissä vapaakappalekirjastoissa/ui}];\n const sf540 = [{code: 'c', value: /laki kulttuuriaineistojen tallettamisesta ja säilyttämisestä/ui}];\n\n function fix(record) {\n if (!hasTag(record, '506', sf506)) { // eslint-disable-line functional/no-conditional-statement\n record.insertField({\n tag: '506',\n ind1: '1',\n subfields: [\n {\n code: 'a',\n value: 'Aineisto on käytettävissä vapaakappalekirjastoissa.'\n }, {\n code: 'f',\n value: 'Online access with authorization'\n }, {\n code: '2',\n value: 'star'\n }, {\n code: '5',\n value: 'FI-Vapaa'\n }, {\n code: '9',\n value: 'FENNI<KEEP>'\n }\n ]\n });\n }\n\n if (!hasTag(record, '540', sf540)) { // eslint-disable-line functional/no-conditional-statement\n record.insertField({\n tag: '540',\n subfields: [\n {\n code: 'a',\n value: 'Aineisto on käytettävissä tutkimus- ja muihin tarkoituksiin;'\n }, {\n code: 'b',\n value: 'Kansalliskirjasto;'\n }, {\n code: 'c',\n value: 'Laki kulttuuriaineistojen tallettamisesta ja säilyttämisestä'\n }, {\n code: 'u',\n value: 'http://www.finlex.fi/fi/laki/ajantasa/2007/20071433'\n }, {\n code: '5',\n value: 'FI-Vapaa'\n }, {\n code: '9',\n value: 'FENNI<KEEP>'\n }\n ]\n });\n }\n\n return true;\n }\n\n function validate(record) {\n return {valid: hasTag(record, '506', sf506) && hasTag(record, '540', sf540)};\n }\n\n return {\n description: 'Adds access rights fields for a record (if not existing)',\n validate,\n fix\n };\n\n function hasTag(rec, tag, sfcv) {\n return rec.fields.some(f => f.tag === tag && sfcv.every(({code, value}) => f.subfields.some(sf => sf.code === code && value.test(sf.value))));\n }\n}\n"],"file":"access-rights.js"}
1
+ {"version":3,"file":"access-rights.js","names":["sf506","code","value","sf540","fix","record","hasTag","insertField","tag","ind1","subfields","validate","valid","description","rec","sfcv","fields","some","f","every","sf","test"],"sources":["../src/access-rights.js"],"sourcesContent":["export default function () {\n const sf506 = [{code: 'a', value: /aineisto on käytettävissä vapaakappalekirjastoissa/ui}];\n const sf540 = [{code: 'c', value: /laki kulttuuriaineistojen tallettamisesta ja säilyttämisestä/ui}];\n\n function fix(record) {\n if (!hasTag(record, '506', sf506)) { // eslint-disable-line functional/no-conditional-statement\n record.insertField({\n tag: '506',\n ind1: '1',\n subfields: [\n {\n code: 'a',\n value: 'Aineisto on käytettävissä vapaakappalekirjastoissa.'\n }, {\n code: 'f',\n value: 'Online access with authorization'\n }, {\n code: '2',\n value: 'star'\n }, {\n code: '5',\n value: 'FI-Vapaa'\n }, {\n code: '9',\n value: 'FENNI<KEEP>'\n }\n ]\n });\n }\n\n if (!hasTag(record, '540', sf540)) { // eslint-disable-line functional/no-conditional-statement\n record.insertField({\n tag: '540',\n subfields: [\n {\n code: 'a',\n value: 'Aineisto on käytettävissä tutkimus- ja muihin tarkoituksiin;'\n }, {\n code: 'b',\n value: 'Kansalliskirjasto;'\n }, {\n code: 'c',\n value: 'Laki kulttuuriaineistojen tallettamisesta ja säilyttämisestä'\n }, {\n code: 'u',\n value: 'http://www.finlex.fi/fi/laki/ajantasa/2007/20071433'\n }, {\n code: '5',\n value: 'FI-Vapaa'\n }, {\n code: '9',\n value: 'FENNI<KEEP>'\n }\n ]\n });\n }\n\n return true;\n }\n\n function validate(record) {\n return {valid: hasTag(record, '506', sf506) && hasTag(record, '540', sf540)};\n }\n\n return {\n description: 'Adds access rights fields for a record (if not existing)',\n validate,\n fix\n };\n\n function hasTag(rec, tag, sfcv) {\n return rec.fields.some(f => f.tag === tag && sfcv.every(({code, value}) => f.subfields.some(sf => sf.code === code && value.test(sf.value))));\n }\n}\n"],"mappings":";;;;;;;AAAe,oBAAY;EACzB,MAAMA,KAAK,GAAG,CAAC;IAACC,IAAI,EAAE,GAAP;IAAYC,KAAK,EAAE;EAAnB,CAAD,CAAd;EACA,MAAMC,KAAK,GAAG,CAAC;IAACF,IAAI,EAAE,GAAP;IAAYC,KAAK,EAAE;EAAnB,CAAD,CAAd;;EAEA,SAASE,GAAT,CAAaC,MAAb,EAAqB;IACnB,IAAI,CAACC,MAAM,CAACD,MAAD,EAAS,KAAT,EAAgBL,KAAhB,CAAX,EAAmC;MAAE;MACnCK,MAAM,CAACE,WAAP,CAAmB;QACjBC,GAAG,EAAE,KADY;QAEjBC,IAAI,EAAE,GAFW;QAGjBC,SAAS,EAAE,CACT;UACET,IAAI,EAAE,GADR;UAEEC,KAAK,EAAE;QAFT,CADS,EAIN;UACDD,IAAI,EAAE,GADL;UAEDC,KAAK,EAAE;QAFN,CAJM,EAON;UACDD,IAAI,EAAE,GADL;UAEDC,KAAK,EAAE;QAFN,C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AACR,SAAF,CAAYO,IAAZ,CAAiBG,EAAE,IAAIA,EAAE,CAACnB,IAAH,KAAYA,IAAZ,IAAoBC,KAAK,CAACmB,IAAN,CAAWD,EAAE,CAAClB,KAAd,CAA3C,CAA9B,CAAtC,CAAP;EACD;AACF"}
@@ -8,33 +8,6 @@ var _accessRights = _interopRequireDefault(require("../src/access-rights"));
8
8
 
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
 
11
- /**
12
- *
13
- * @licstart The following is the entire license notice for the JavaScript code in this file.
14
- *
15
- * MARC record validators used in Melinda
16
- *
17
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
18
- *
19
- * This file is part of marc-record-validators-melinda
20
- *
21
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
22
- * it under the terms of the GNU Lesser General Public License as
23
- * published by the Free Software Foundation, either version 3 of the
24
- * License, or (at your option) any later version.
25
- *
26
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
27
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
- * GNU Lesser General Public License for more details.
30
- *
31
- * You should have received a copy of the GNU Lesser General Public License
32
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
33
- *
34
- * @licend The above is the entire license notice
35
- * for the JavaScript code in this file.
36
- *
37
- */
38
11
  describe('access-rights', async () => {
39
12
  // Fields
40
13
  const ldf5061 = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/access-rights.spec.js"],"names":["describe","ldf5061","tag","ind1","ind2","subfields","code","value","ldf540","f5060","f540","it","validator","to","be","an","that","has","any","keys","description","a","validate","test","valid","recfields","result","MarcRecord","fields","eql","fix","resfields","record"],"mappings":";;AA6BA;;AACA;;AACA;;;;AA/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AAN;AACD,KAFC,CAAF;AAGD,GAhBO,CAAR;AAkBAV,EAAAA,QAAQ,CAAC,MAAD,EAAS,MAAM;AACrBW,IAAAA,EAAE,CAAC,mDAAD,EAAsD,YAAY;AAClE,YAAMY,IAAI,CAACO,GAAL,CAAS,CAAC7B,OAAD,EAAUO,MAAV,CAAT,EAA4B,CAACP,OAAD,EAAUO,MAAV,CAA5B,CAAN;AACD,KAFC,CAAF;AAIAG,IAAAA,EAAE,CAAC,iCAAD,EAAoC,YAAY;AAChD,YAAMY,IAAI,CAACO,GAAL,CAAS,CAACrB,KAAD,EAAQD,MAAR,CAAT,EAA0B,CAACC,KAAD,EAAQR,OAAR,EAAiBO,MAAjB,CAA1B,CAAN;AACD,KAFC,CAAF;AAIAG,IAAAA,EAAE,CAAC,gCAAD,EAAmC,YAAY;AAC/C,YAAMY,IAAI,CAACO,GAAL,CAAS,CAAC7B,OAAD,EAAUS,IAAV,CAAT,EAA0B,CAACT,OAAD,EAAUS,IAAV,EAAgBF,MAAhB,CAA1B,CAAN;AACD,KAFC,CAAF;AAIAG,IAAAA,EAAE,CAAC,gDAAD,EAAmD,YAAY;AAC/D,YAAMY,IAAI,CAACO,GAAL,CAAS,CAACrB,KAAD,EAAQC,IAAR,CAAT,EAAwB,CAACD,KAAD,EAAQR,OAAR,EAAiBS,IAAjB,EAAuBF,MAAvB,CAAxB,CAAN;AACD,KAFC,CAAF;AAGD,GAhBO,CAAR;AAiBD,CA5GO,CAAR","sourcesContent":["/**\n *\n * @licstart The following is the entire license notice for the JavaScript code in this file.\n *\n * MARC record validators used in Melinda\n *\n * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)\n *\n * This file is part of marc-record-validators-melinda\n *\n * marc-record-validators-melinda 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 * marc-record-validators-melinda 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 Lesser 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\n\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from '../src/access-rights';\n\ndescribe('access-rights', async () => {\n // Fields\n const ldf5061 = {\n tag: '506',\n ind1: '1',\n ind2: ' ',\n subfields: [\n {code: 'a', value: 'Aineisto on käytettävissä vapaakappalekirjastoissa.'},\n {code: 'f', value: 'Online access with authorization'},\n {code: '2', value: 'star'},\n {code: '5', value: 'FI-Vapaa'},\n {code: '9', value: 'FENNI<KEEP>'}\n ]\n };\n const ldf540 = {\n tag: '540',\n ind1: ' ',\n ind2: ' ',\n subfields: [\n {code: 'a', value: 'Aineisto on käytettävissä tutkimus- ja muihin tarkoituksiin;'},\n {code: 'b', value: 'Kansalliskirjasto;'},\n {code: 'c', value: 'Laki kulttuuriaineistojen tallettamisesta ja säilyttämisestä'},\n {code: 'u', value: 'http://www.finlex.fi/fi/laki/ajantasa/2007/20071433'},\n {code: '5', value: 'FI-Vapaa'},\n {code: '9', value: 'FENNI<KEEP>'}\n ]\n };\n const f5060 = {\n tag: '506',\n ind1: '0',\n ind2: ' ',\n subfields: [\n {code: 'a', value: 'Aineisto on vapaasti saatavissa.'},\n {code: 'f', value: 'Unrestricted online access'},\n {code: '2', value: 'star'},\n {code: '9', value: 'FENNI<KEEP>'}\n ]\n };\n const f540 = {\n tag: '540',\n ind1: ' ',\n ind2: ' ',\n subfields: [{code: 'c', value: 'This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.'}]\n };\n\n it('Creates a validator', async () => {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n });\n\n // Tests\n const test = await (async () => {\n const validator = await validatorFactory();\n return {\n validate: async (valid, ...recfields) => {\n const result = await validator.validate(new MarcRecord({fields: recfields}));\n expect(result).to.eql({valid});\n },\n\n fix: async (recfields, resfields) => {\n const record = new MarcRecord({fields: recfields});\n await validator.fix(record);\n expect(record.fields).to.eql(resfields);\n }\n };\n })();\n\n describe('#validate', () => {\n it('Finds the record valid; Legal deposit fields 5061 and 540', async () => {\n await test.validate(true, ldf5061, ldf540);\n });\n\n it('Finds the record invalid; Missing 5061', async () => {\n await test.validate(false, f5060, ldf540);\n });\n\n it('Finds the record invalid; Missing 540', async () => {\n await test.validate(false, ldf5061, f540);\n });\n\n it('Finds the record invalid; Missing 5061 and 540', async () => {\n await test.validate(false, f5060, f540);\n });\n });\n\n describe('#fix', () => {\n it('Legal deposit fields 5061 and 540; Nothing to add', async () => {\n await test.fix([ldf5061, ldf540], [ldf5061, ldf540]);\n });\n\n it('540 but missing 5061; Adds 5061', async () => {\n await test.fix([f5060, ldf540], [f5060, ldf5061, ldf540]);\n });\n\n it('5061 but missing 540; Adds 540', async () => {\n await test.fix([ldf5061, f540], [ldf5061, f540, ldf540]);\n });\n\n it('Both, 5061 and 540, missing; Adds 5061 and 540', async () => {\n await test.fix([f5060, f540], [f5060, ldf5061, f540, ldf540]);\n });\n });\n});\n"],"file":"access-rights.spec.js"}
1
+ {"version":3,"file":"access-rights.spec.js","names":["describe","ldf5061","tag","ind1","ind2","subfields","code","value","ldf540","f5060","f540","it","validator","to","be","an","that","has","any","keys","description","a","validate","test","valid","recfields","result","MarcRecord","fields","eql","fix","resfields","record"],"sources":["../src/access-rights.spec.js"],"sourcesContent":["import {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from '../src/access-rights';\n\ndescribe('access-rights', async () => {\n // Fields\n const ldf5061 = {\n tag: '506',\n ind1: '1',\n ind2: ' ',\n subfields: [\n {code: 'a', value: 'Aineisto on käytettävissä vapaakappalekirjastoissa.'},\n {code: 'f', value: 'Online access with authorization'},\n {code: '2', value: 'star'},\n {code: '5', value: 'FI-Vapaa'},\n {code: '9', value: 'FENNI<KEEP>'}\n ]\n };\n const ldf540 = {\n tag: '540',\n ind1: ' ',\n ind2: ' ',\n subfields: [\n {code: 'a', value: 'Aineisto on käytettävissä tutkimus- ja muihin tarkoituksiin;'},\n {code: 'b', value: 'Kansalliskirjasto;'},\n {code: 'c', value: 'Laki kulttuuriaineistojen tallettamisesta ja säilyttämisestä'},\n {code: 'u', value: 'http://www.finlex.fi/fi/laki/ajantasa/2007/20071433'},\n {code: '5', value: 'FI-Vapaa'},\n {code: '9', value: 'FENNI<KEEP>'}\n ]\n };\n const f5060 = {\n tag: '506',\n ind1: '0',\n ind2: ' ',\n subfields: [\n {code: 'a', value: 'Aineisto on vapaasti saatavissa.'},\n {code: 'f', value: 'Unrestricted online access'},\n {code: '2', value: 'star'},\n {code: '9', value: 'FENNI<KEEP>'}\n ]\n };\n const f540 = {\n tag: '540',\n ind1: ' ',\n ind2: ' ',\n subfields: [{code: 'c', value: 'This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.'}]\n };\n\n it('Creates a validator', async () => {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n });\n\n // Tests\n const test = await (async () => {\n const validator = await validatorFactory();\n return {\n validate: async (valid, ...recfields) => {\n const result = await validator.validate(new MarcRecord({fields: recfields}));\n expect(result).to.eql({valid});\n },\n\n fix: async (recfields, resfields) => {\n const record = new MarcRecord({fields: recfields});\n await validator.fix(record);\n expect(record.fields).to.eql(resfields);\n }\n };\n })();\n\n describe('#validate', () => {\n it('Finds the record valid; Legal deposit fields 5061 and 540', async () => {\n await test.validate(true, ldf5061, ldf540);\n });\n\n it('Finds the record invalid; Missing 5061', async () => {\n await test.validate(false, f5060, ldf540);\n });\n\n it('Finds the record invalid; Missing 540', async () => {\n await test.validate(false, ldf5061, f540);\n });\n\n it('Finds the record invalid; Missing 5061 and 540', async () => {\n await test.validate(false, f5060, f540);\n });\n });\n\n describe('#fix', () => {\n it('Legal deposit fields 5061 and 540; Nothing to add', async () => {\n await test.fix([ldf5061, ldf540], [ldf5061, ldf540]);\n });\n\n it('540 but missing 5061; Adds 5061', async () => {\n await test.fix([f5060, ldf540], [f5060, ldf5061, ldf540]);\n });\n\n it('5061 but missing 540; Adds 540', async () => {\n await test.fix([ldf5061, f540], [ldf5061, f540, ldf540]);\n });\n\n it('Both, 5061 and 540, missing; Adds 5061 and 540', async () => {\n await test.fix([f5060, f540], [f5060, ldf5061, f540, ldf540]);\n });\n });\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEAA,QAAQ,CAAC,eAAD,EAAkB,YAAY;EACpC;EACA,MAAMC,OAAO,GAAG;IACdC,GAAG,EAAE,KADS;IAEdC,IAAI,EAAE,GAFQ;IAGdC,IAAI,EAAE,GAHQ;IAIdC,SAAS,EAAE,CACT;MAACC,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CADS,EAET;MAACD,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CAFS,EAGT;MAACD,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CAHS,EAIT;MAACD,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CAJS,EAKT;MAACD,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CALS;EAJG,CAAhB;EAYA,MAAMC,MAAM,GAAG;IACbN,GAAG,EAAE,KADQ;IAEbC,IAAI,EAAE,GAFO;IAGbC,IAAI,EAAE,GAHO;IAIbC,SAAS,EAAE,CACT;MAACC,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CADS,EAET;MAACD,IAAI,EAAE,GAAP;MAAYC,KAAK,EAAE;IAAnB,CAFS,EAGT;MAACD,IAAI,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KAAd,EAAqBb,KAArB,EAA4BC,IAA5B,CAAN;IACD,CAFC,CAAF;EAGD,CAhBO,CAAR;EAkBAV,QAAQ,CAAC,MAAD,EAAS,MAAM;IACrBW,EAAE,CAAC,mDAAD,EAAsD,YAAY;MAClE,MAAMY,IAAI,CAACO,GAAL,CAAS,CAAC7B,OAAD,EAAUO,MAAV,CAAT,EAA4B,CAACP,OAAD,EAAUO,MAAV,CAA5B,CAAN;IACD,CAFC,CAAF;IAIAG,EAAE,CAAC,iCAAD,EAAoC,YAAY;MAChD,MAAMY,IAAI,CAACO,GAAL,CAAS,CAACrB,KAAD,EAAQD,MAAR,CAAT,EAA0B,CAACC,KAAD,EAAQR,OAAR,EAAiBO,MAAjB,CAA1B,CAAN;IACD,CAFC,CAAF;IAIAG,EAAE,CAAC,gCAAD,EAAmC,YAAY;MAC/C,MAAMY,IAAI,CAACO,GAAL,CAAS,CAAC7B,OAAD,EAAUS,IAAV,CAAT,EAA0B,CAACT,OAAD,EAAUS,IAAV,EAAgBF,MAAhB,CAA1B,CAAN;IACD,CAFC,CAAF;IAIAG,EAAE,CAAC,gDAAD,EAAmD,YAAY;MAC/D,MAAMY,IAAI,CAACO,GAAL,CAAS,CAACrB,KAAD,EAAQC,IAAR,CAAT,EAAwB,CAACD,KAAD,EAAQR,OAAR,EAAiBS,IAAjB,EAAuBF,MAAvB,CAAxB,CAAN;IACD,CAFC,CAAF;EAGD,CAhBO,CAAR;AAiBD,CA5GO,CAAR"}
@@ -5,33 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = _default;
7
7
 
8
- /**
9
- *
10
- * @licstart The following is the entire license notice for the JavaScript code in this file.
11
- *
12
- * MARC record validators used in Melinda
13
- *
14
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
15
- *
16
- * This file is part of marc-record-validators-melinda
17
- *
18
- * marc-record-validators-melinda 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
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
24
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- * GNU Lesser General Public License for more details.
27
- *
28
- * You should have received a copy of the GNU Lesser General Public License
29
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
30
- *
31
- * @licend The above is the entire license notice
32
- * for the JavaScript code in this file.
33
- *
34
- */
35
8
  function _default() {
36
9
  return {
37
10
  description: 'Handle double commas in 700$e-subfields',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/double-commas.js"],"names":["description","validate","record","valid","get","some","f","subfields","every","sf","code","test","value","fix","forEach","filter","replace"],"mappings":";;;;;;;AAAA;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;AAGe,oBAAY;AACzB,SAAO;AACLA,IAAAA,WAAW,EAAE,yCADR;AAELC,IAAAA,QAAQ,EAAEC,MAAM,KAAK;AACnBC,MAAAA,KAAK,EAAE,CAACD,MAAM,CACXE,GADK,CACD,QADC,EAELC,IAFK,CAEAC,CAAC,IAAIA,CAAC,CAACC,SAAF,CAAYC,KAAZ,CAAkBC,EAAE,IAAIA,EAAE,CAACC,IAAH,KAAY,GAAZ,IAAoB,KAAD,CAAQC,IAAR,CAAaF,EAAE,CAACG,KAAhB,CAA3C,CAFL;AADW,KAAL,CAFX;AAOLC,IAAAA,GAAG,EAAEX,MAAM,IAAIA,MAAM,CAACE,GAAP,CAAW,QAAX,EAAqBU,OAArB,CAA6BR,CAAC,IAAIA,CAAC,CAACC,SAAF,CAAYQ,MAAZ,CAAmBN,EAAE,IAAIA,EAAE,CAACC,IAAH,KAAY,GAArC,EAA0CI,OAA1C,CAAkDL,EAAE,IAAI;AACvGA,MAAAA,EAAE,CAACG,KAAH,GAAWH,EAAE,CAACG,KAAH,CAASI,OAAT,CAAiB,KAAjB,EAAwB,GAAxB,CAAX,CADuG,CAC9D;AAC1C,KAFgD,CAAlC;AAPV,GAAP;AAWD","sourcesContent":["/**\n *\n * @licstart The following is the entire license notice for the JavaScript code in this file.\n *\n * MARC record validators used in Melinda\n *\n * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)\n *\n * This file is part of marc-record-validators-melinda\n *\n * marc-record-validators-melinda 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 * marc-record-validators-melinda 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 Lesser 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\n\nexport default function () {\n return {\n description: 'Handle double commas in 700$e-subfields',\n validate: record => ({\n valid: !record\n .get(/^700$/u)\n .some(f => f.subfields.every(sf => sf.code === 'e' && (/,,/u).test(sf.value)))\n }),\n fix: record => record.get(/^700$/u).forEach(f => f.subfields.filter(sf => sf.code === 'e').forEach(sf => {\n sf.value = sf.value.replace(/,,/u, ','); // eslint-disable-line functional/immutable-data\n }))\n };\n}\n"],"file":"double-commas.js"}
1
+ {"version":3,"file":"double-commas.js","names":["description","validate","record","valid","get","some","f","subfields","every","sf","code","test","value","fix","forEach","filter","replace"],"sources":["../src/double-commas.js"],"sourcesContent":["export default function () {\n return {\n description: 'Handle double commas in 700$e-subfields',\n validate: record => ({\n valid: !record\n .get(/^700$/u)\n .some(f => f.subfields.every(sf => sf.code === 'e' && (/,,/u).test(sf.value)))\n }),\n fix: record => record.get(/^700$/u).forEach(f => f.subfields.filter(sf => sf.code === 'e').forEach(sf => {\n sf.value = sf.value.replace(/,,/u, ','); // eslint-disable-line functional/immutable-data\n }))\n };\n}\n"],"mappings":";;;;;;;AAAe,oBAAY;EACzB,OAAO;IACLA,WAAW,EAAE,yCADR;IAELC,QAAQ,EAAEC,MAAM,KAAK;MACnBC,KAAK,EAAE,CAACD,MAAM,CACXE,GADK,CACD,QADC,EAELC,IAFK,CAEAC,CAAC,IAAIA,CAAC,CAACC,SAAF,CAAYC,KAAZ,CAAkBC,EAAE,IAAIA,EAAE,CAACC,IAAH,KAAY,GAAZ,IAAoB,KAAD,CAAQC,IAAR,CAAaF,EAAE,CAACG,KAAhB,CAA3C,CAFL;IADW,CAAL,CAFX;IAOLC,GAAG,EAAEX,MAAM,IAAIA,MAAM,CAACE,GAAP,CAAW,QAAX,EAAqBU,OAArB,CAA6BR,CAAC,IAAIA,CAAC,CAACC,SAAF,CAAYQ,MAAZ,CAAmBN,EAAE,IAAIA,EAAE,CAACC,IAAH,KAAY,GAArC,EAA0CI,OAA1C,CAAkDL,EAAE,IAAI;MACvGA,EAAE,CAACG,KAAH,GAAWH,EAAE,CAACG,KAAH,CAASI,OAAT,CAAiB,KAAjB,EAAwB,GAAxB,CAAX,CADuG,CAC9D;IAC1C,CAFgD,CAAlC;EAPV,CAAP;AAWD"}
@@ -8,33 +8,6 @@ var _doubleCommas = _interopRequireDefault(require("../src/double-commas"));
8
8
 
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
 
11
- /**
12
- *
13
- * @licstart The following is the entire license notice for the JavaScript code in this file.
14
- *
15
- * MARC record validators used in Melinda
16
- *
17
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
18
- *
19
- * This file is part of marc-record-validators-melinda
20
- *
21
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
22
- * it under the terms of the GNU Lesser General Public License as
23
- * published by the Free Software Foundation, either version 3 of the
24
- * License, or (at your option) any later version.
25
- *
26
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
27
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
- * GNU Lesser General Public License for more details.
30
- *
31
- * You should have received a copy of the GNU Lesser General Public License
32
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
33
- *
34
- * @licend The above is the entire license notice
35
- * for the JavaScript code in this file.
36
- *
37
- */
38
11
  describe('double-commas', () => {
39
12
  it('Creates a validator', async () => {
40
13
  const validator = await (0, _doubleCommas.default)();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/double-commas.spec.js"],"names":["describe","it","validator","to","be","an","that","has","any","keys","description","a","validate","record","MarcRecord","fields","tag","subfields","code","value","result","eql","valid","fix","ind1","ind2"],"mappings":";;AA6BA;;AACA;;AACA;;;;AA/BA;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;AAOAA,QAAQ,CAAC,eAAD,EAAkB,MAAM;AAC9BC,EAAAA,EAAE,CAAC,qBAAD,EAAwB,YAAY;AACpC,UAAMC,SAAS,GAAG,MAAM,4BAAxB;AAEA,sBAAOA,SAAP,EACGC,EADH,CACMC,EADN,CACSC,EADT,CACY,QADZ,EAEGC,IAFH,CAEQC,GAFR,CAEYC,GAFZ,CAEgBC,IAFhB,CAEqB,aAFrB,EAEoC,UAFpC;AAIA,sBAAOP,SAAS,CAACQ,WAAjB,EAA8BP,EAA9B,CAAiCC,EAAjC,CAAoCO,CAApC,CAAsC,QAAtC;AACA,sBAAOT,SAAS,CAACU,QAAjB,EAA2BT,EAA3B,CAA8BC,EAA9B,CAAiCO,CAAjC,CAAmC,UAAnC;AACD,GATC,CAAF;AAWAX,EAAAA,QAAQ,CAAC,WAAD,EAAc,MAAM;AAC1BC,IAAAA,EAAE,CAAC,wBAAD,EAA2B,YAAY;AACvC,YAAMC,SAAS,G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AaC,UAAAA,SAAS,EAAE,CAAC;AAACC,YAAAA,IAAI,EAAE,GAAP;AAAYC,YAAAA,KAAK,EAAE;AAAnB,WAAD;AAAxB,SAAD;AADoB,OAAf,CAAf;AAGA,YAAMjB,SAAS,CAACqB,GAAV,CAAcV,MAAd,CAAN;AAEA,wBAAOA,MAAM,CAACE,MAAd,EAAsBZ,EAAtB,CAAyBkB,GAAzB,CAA6B,CAC3B;AACEL,QAAAA,GAAG,EAAE,KADP;AAEEQ,QAAAA,IAAI,EAAE,GAFR;AAGEC,QAAAA,IAAI,EAAE,GAHR;AAIER,QAAAA,SAAS,EAAE,CAAC;AAACC,UAAAA,IAAI,EAAE,GAAP;AAAYC,UAAAA,KAAK,EAAE;AAAnB,SAAD;AAJb,OAD2B,CAA7B;AAQD,KAfC,CAAF;AAgBD,GAjBO,CAAR;AAkBD,CAnDO,CAAR","sourcesContent":["/**\n *\n * @licstart The following is the entire license notice for the JavaScript code in this file.\n *\n * MARC record validators used in Melinda\n *\n * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)\n *\n * This file is part of marc-record-validators-melinda\n *\n * marc-record-validators-melinda 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 * marc-record-validators-melinda 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 Lesser 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\n\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from '../src/double-commas';\n\ndescribe('double-commas', () => {\n it('Creates a validator', async () => {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n });\n\n describe('#validate', () => {\n it('Finds the record valid', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [{tag: '700', subfields: [{code: 'e', value: 'foo,bar'}]}]\n });\n const result = await validator.validate(record);\n\n expect(result).to.eql({valid: true});\n });\n it('Finds the record invalid', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [{tag: '700', subfields: [{code: 'e', value: 'foo,,bar'}]}]\n });\n const result = await validator.validate(record);\n\n expect(result).to.eql({valid: false});\n });\n });\n\n describe('#fix', () => {\n it('Fixes the record', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [{tag: '700', subfields: [{code: 'e', value: 'foo,,bar'}]}]\n });\n await validator.fix(record);\n\n expect(record.fields).to.eql([\n {\n tag: '700',\n ind1: ' ',\n ind2: ' ',\n subfields: [{code: 'e', value: 'foo,bar'}]\n }\n ]);\n });\n });\n});\n"],"file":"double-commas.spec.js"}
1
+ {"version":3,"file":"double-commas.spec.js","names":["describe","it","validator","to","be","an","that","has","any","keys","description","a","validate","record","MarcRecord","fields","tag","subfields","code","value","result","eql","valid","fix","ind1","ind2"],"sources":["../src/double-commas.spec.js"],"sourcesContent":["import {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from '../src/double-commas';\n\ndescribe('double-commas', () => {\n it('Creates a validator', async () => {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n });\n\n describe('#validate', () => {\n it('Finds the record valid', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [{tag: '700', subfields: [{code: 'e', value: 'foo,bar'}]}]\n });\n const result = await validator.validate(record);\n\n expect(result).to.eql({valid: true});\n });\n it('Finds the record invalid', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [{tag: '700', subfields: [{code: 'e', value: 'foo,,bar'}]}]\n });\n const result = await validator.validate(record);\n\n expect(result).to.eql({valid: false});\n });\n });\n\n describe('#fix', () => {\n it('Fixes the record', async () => {\n const validator = await validatorFactory();\n const record = new MarcRecord({\n fields: [{tag: '700', subfields: [{code: 'e', value: 'foo,,bar'}]}]\n });\n await validator.fix(record);\n\n expect(record.fields).to.eql([\n {\n tag: '700',\n ind1: ' ',\n ind2: ' ',\n subfields: [{code: 'e', value: 'foo,bar'}]\n }\n ]);\n });\n });\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;;;AAEAA,QAAQ,CAAC,eAAD,EAAkB,MAAM;EAC9BC,EAAE,CAAC,qBAAD,EAAwB,YAAY;IACpC,MAAMC,SAAS,GAAG,MAAM,4BAAxB;IAEA,kBAAOA,SAAP,EACGC,EADH,CACMC,EADN,CACSC,EADT,CACY,QADZ,EAEGC,IAFH,CAEQC,GAFR,CAEYC,GAFZ,CAEgBC,IAFhB,CAEqB,aAFrB,EAEoC,UAFpC;IAIA,kBAAOP,SAAS,CAACQ,WAAjB,EAA8BP,EAA9B,CAAiCC,EAAjC,CAAoCO,CAApC,CAAsC,QAAtC;IACA,kBAAOT,SAAS,CAACU,QAAjB,EAA2BT,EAA3B,CAA8BC,EAA9B,CAAiCO,CAAjC,CAAmC,UAAnC;EACD,CATC,CAAF;EAWAX,QAAQ,CAAC,WAAD,EAAc,MAAM;IAC1BC,EAAE,CAAC,wBAAD,EAA2B,YAAY;MACvC,MAAMC,SAAS,GAAG,MAAM,4BAAxB;MACA,MAAMW,MAAM,GAAG,IAAIC,sBAAJ,CAAe;QAC5BC,MAAM,EAAE,CAAC;UAACC,GAAG,EAAE,KAAN;UAAaC,SAAS,EAAE,CAAC;YAACC,IAAI,EAAE,GAAP;YAAYC,KAAK,EAAE;UAAnB,CAAD;QAAxB,CAAD;MADoB,CAAf,CAAf;MAGA,MAAMC,MAAM,GAAG,MAAMlB,SAAS,CAACU,QAAV,CAAmBC,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,CAA7B;IAQD,CAfC,CAAF;EAgBD,CAjBO,CAAR;AAkBD,CAnDO,CAAR"}
@@ -5,33 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = _default;
7
7
 
8
- /**
9
- *
10
- * @licstart The following is the entire license notice for the JavaScript code in this file.
11
- *
12
- * MARC record validators used in Melinda
13
- *
14
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
15
- *
16
- * This file is part of marc-record-validators-melinda
17
- *
18
- * marc-record-validators-melinda 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
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
24
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- * GNU Lesser General Public License for more details.
27
- *
28
- * You should have received a copy of the GNU Lesser General Public License
29
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
30
- *
31
- * @licend The above is the entire license notice
32
- * for the JavaScript code in this file.
33
- *
34
- */
35
8
  function _default(tagPattern) {
36
9
  if (tagPattern instanceof RegExp) {
37
10
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/duplicates-ind1.js"],"names":["tagPattern","RegExp","description","validate","fix","Error","record","invalid","iterateFields","find","obj","validation","valid","messages","tag","filter","item","map","forEach","field","removeField","fields","matches","test","ind1","hasDuplicate","fieldA","some","fieldB","subfields","length","every","aSf","bSf","code","value"],"mappings":";;;;;;;AAAA;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;AAGe,kBAAUA,UAAV,EAAsB;AACnC,MAAIA,UAAU,YAAYC,MAA1B,EAAkC;AAChC,WAAO;AACLC,MAAAA,WAAW,EACT,6DAFG;AA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EAAQE,MAAR,CAAvE;AACD;;AAED,WAASI,YAAT,CAAsBC,MAAtB,EAA8BL,MAA9B,EAAsC;AACpC,WAAOA,MAAM,CAACM,IAAP,CAAYC,MAAM,IAAIF,MAAM,KAAKE,MAAX,IAC3BF,MAAM,CAACZ,GAAP,KAAec,MAAM,CAACd,GADK,IAE3BY,MAAM,CAACF,IAAP,KAAgBI,MAAM,CAACJ,IAFI,IAG3BE,MAAM,CAACG,SAAP,CAAiBC,MAAjB,KAA4BF,MAAM,CAACC,SAAP,CAAiBC,MAHlB,IAI3BJ,MAAM,CAACG,SAAP,CAAiBE,KAAjB,CAAuBC,GAAG,IAAIJ,MAAM,CAACC,SAAP,CAAiBF,IAAjB,CAAsBM,GAAG,IAAID,GAAG,CAACE,IAAJ,KAAaD,GAAG,CAACC,IAAjB,IAAyBF,GAAG,CAACG,KAAJ,KAAcF,GAAG,CAACE,KAAxE,CAA9B,CAJK,CAAP;AAKD;AACF","sourcesContent":["/**\n *\n * @licstart The following is the entire license notice for the JavaScript code in this file.\n *\n * MARC record validators used in Melinda\n *\n * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)\n *\n * This file is part of marc-record-validators-melinda\n *\n * marc-record-validators-melinda 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 * marc-record-validators-melinda 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 Lesser 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\n\nexport default function (tagPattern) {\n if (tagPattern instanceof RegExp) {\n return {\n description:\n 'Handles data fields that only differ in the first indicator',\n validate,\n fix\n };\n }\n\n throw new Error('No tagPattern provided');\n\n function validate(record) {\n const invalid = iterateFields(record)\n .find(obj => obj.validation === true);\n return invalid ? {valid: false, messages: [`Multiple ${invalid.obj.tag} fields which only differ in the first indicator`]} : {valid: true, messages: []};\n }\n\n function fix(record) {\n iterateFields(record)\n .filter(item => item.validation === false)\n .map(({validation, ...item}) => item) // eslint-disable-line no-unused-vars\n .forEach(field => record.removeField(field));\n }\n\n function iterateFields(record) {\n return record.fields.map(obj => ({validation: matches(obj, record.fields), obj}));\n }\n\n function matches(field, fields) {\n return tagPattern.test(field.tag) && field.ind1 === ' ' && hasDuplicate(field, fields);\n }\n\n function hasDuplicate(fieldA, fields) {\n return fields.some(fieldB => fieldA !== fieldB &&\n fieldA.tag === fieldB.tag &&\n fieldA.ind1 !== fieldB.ind1 &&\n fieldA.subfields.length === fieldB.subfields.length &&\n fieldA.subfields.every(aSf => fieldB.subfields.some(bSf => aSf.code === bSf.code && aSf.value === bSf.value)));\n }\n}\n"],"file":"duplicates-ind1.js"}
1
+ {"version":3,"file":"duplicates-ind1.js","names":["tagPattern","RegExp","description","validate","fix","Error","record","invalid","iterateFields","find","obj","validation","valid","messages","tag","filter","item","map","forEach","field","removeField","fields","matches","test","ind1","hasDuplicate","fieldA","some","fieldB","subfields","length","every","aSf","bSf","code","value"],"sources":["../src/duplicates-ind1.js"],"sourcesContent":["export default function (tagPattern) {\n if (tagPattern instanceof RegExp) {\n return {\n description:\n 'Handles data fields that only differ in the first indicator',\n validate,\n fix\n };\n }\n\n throw new Error('No tagPattern provided');\n\n function validate(record) {\n const invalid = iterateFields(record)\n .find(obj => obj.validation === true);\n return invalid ? {valid: false, messages: [`Multiple ${invalid.obj.tag} fields which only differ in the first indicator`]} : {valid: true, messages: []};\n }\n\n function fix(record) {\n iterateFields(record)\n .filter(item => item.validation === false)\n .map(({validation, ...item}) => item) // eslint-disable-line no-unused-vars\n .forEach(field => record.removeField(field));\n }\n\n function iterateFields(record) {\n return record.fields.map(obj => ({validation: matches(obj, record.fields), obj}));\n }\n\n function matches(field, fields) {\n return tagPattern.test(field.tag) && field.ind1 === ' ' && hasDuplicate(field, fields);\n }\n\n function hasDuplicate(fieldA, fields) {\n return fields.some(fieldB => fieldA !== fieldB &&\n fieldA.tag === fieldB.tag &&\n fieldA.ind1 !== fieldB.ind1 &&\n fieldA.subfields.length === fieldB.subfields.length &&\n fieldA.subfields.every(aSf => fieldB.subfields.some(bSf => aSf.code === bSf.code && aSf.value === bSf.value)));\n }\n}\n"],"mappings":";;;;;;;AAAe,kBAAUA,UAAV,EAAsB;EACnC,IAAIA,UAAU,YAAYC,MAA1B,EAAkC;IAChC,OAAO;MACLC,WAAW,EACT,6DAFG;MAGLC,QAHK;MAILC;IAJK,CAAP;EAMD;;EAED,MAAM,IAAIC,KAAJ,CAAU,wBAAV,CAAN;;EAEA,SAASF,QAAT,CAAkBG,MAAlB,EAA0B;IACxB,MAAMC,OAAO,GAAGC,aAAa,CAACF,MAAD,CAAb,CACbG,IADa,CACRC,GAAG,IAAIA,GAAG,CAACC,UAAJ,KAAmB,IADlB,CAAhB;IAEA,OAAOJ,OAAO,GAAG;MAACK,KAAK,EAAE,KAAR;MAAeC,QAAQ,EAAE,CAAE,YAAWN,OAAO,CAACG,GAAR,CAAYI,GAAI,kDAA7B;IAAzB,CAAH,GAA+G;MAACF,KAAK,EAAE,IAAR;MAAcC,QAAQ,EAAE;IAAxB,CAA7H;EACD;;EAED,SAAST,GAAT,CAAaE,MAAb,EAAqB;IACnBE,aAAa,CAACF,MAAD,CAAb,CACGS,MADH,CACUC,IAAI,IAAIA,IAAI,CAACL,UAAL,KAAoB,KADtC,EAEGM,GAFH,CAEO,CAAC;MAACN,UAAD;MAAa,GAAGK;IAAhB,CAAD,KAA2BA,IAFlC,EAEwC;IAFxC,CAGGE,OAHH,CAGWC,KAAK,IAAIb,MAAM,CAACc,WAAP,CAAmBD,KAAnB,CAHpB;EAID;;EAED,SAASX,aAAT,CAAuBF,MAAvB,EAA+B;IAC7B,OAAOA,MAAM,CAACe,MAAP,CAA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