@natlibfi/marc-record-merge 6.0.0-beta.1 → 6.0.0-beta.10

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 (246) hide show
  1. package/.github/CODEOWNERS +9 -0
  2. package/.github/dependabot.yml +41 -0
  3. package/.github/workflows/melinda-node-tests.yml +60 -0
  4. package/LICENSE +21 -0
  5. package/README.md +122 -2
  6. package/dist/index.js +42 -43
  7. package/dist/index.js.map +1 -1
  8. package/dist/reducers/copy.js +232 -83
  9. package/dist/reducers/copy.js.map +1 -1
  10. package/dist/reducers/copy.spec.js +57 -72
  11. package/dist/reducers/copy.spec.js.map +1 -1
  12. package/dist/reducers/index.js +13 -24
  13. package/dist/reducers/index.js.map +1 -1
  14. package/dist/reducers/select.js +33 -51
  15. package/dist/reducers/select.js.map +1 -1
  16. package/dist/reducers/select.spec.js +45 -92
  17. package/dist/reducers/select.spec.js.map +1 -1
  18. package/package.json +33 -32
  19. package/src/index.js +30 -32
  20. package/src/reducers/copy.js +242 -79
  21. package/src/reducers/copy.spec.js +50 -48
  22. package/src/reducers/index.js +3 -30
  23. package/src/reducers/select.js +27 -34
  24. package/src/reducers/select.spec.js +41 -56
  25. package/test-fixtures/reducers/copy/{01/base.json → 01 - copy/01/base.json } +1 -1
  26. package/test-fixtures/reducers/copy/{01 → 01 - copy/01}/merged.json +0 -0
  27. package/test-fixtures/reducers/copy/01 - copy/01/metadata.json +4 -0
  28. package/test-fixtures/reducers/copy/{01 → 01 - copy/01}/source.json +0 -0
  29. package/test-fixtures/reducers/copy/{02/source.json → 01 - copy/02/base.json} +0 -0
  30. package/test-fixtures/reducers/copy/{02 → 01 - copy/02}/merged.json +0 -0
  31. package/test-fixtures/reducers/copy/01 - copy/02/metadata.json +4 -0
  32. package/test-fixtures/reducers/copy/{02/base.json → 01 - copy/02/source.json } +1 -1
  33. package/test-fixtures/reducers/copy/{03/base.json → 01 - copy/03/base.json } +1 -1
  34. package/test-fixtures/reducers/copy/{03 → 01 - copy/03}/merged.json +0 -0
  35. package/test-fixtures/reducers/copy/01 - copy/03/metadata.json +4 -0
  36. package/test-fixtures/reducers/copy/{03 → 01 - copy/03}/source.json +0 -0
  37. package/test-fixtures/reducers/copy/{05/base.json → 01 - copy/04/base.json } +1 -1
  38. package/test-fixtures/reducers/copy/{04/merged.json → 01 - copy/04/merged.json } +1 -1
  39. package/test-fixtures/reducers/copy/01 - copy/04/metadata.json +4 -0
  40. package/test-fixtures/reducers/copy/{04/source.json → 01 - copy/04/source.json } +1 -1
  41. package/test-fixtures/reducers/copy/{04/base.json → 01 - copy/05/base.json } +1 -1
  42. package/test-fixtures/reducers/copy/01 - copy/05/merged.json +77 -0
  43. package/test-fixtures/reducers/copy/01 - copy/05/metadata.json +4 -0
  44. package/test-fixtures/reducers/copy/01 - copy/05/source.json +62 -0
  45. package/test-fixtures/reducers/copy/01 - copy/06/base.json +24 -0
  46. package/test-fixtures/reducers/copy/01 - copy/06/merged.json +39 -0
  47. package/test-fixtures/reducers/copy/01 - copy/06/metadata.json +4 -0
  48. package/test-fixtures/reducers/copy/01 - copy/06/source.json +24 -0
  49. package/test-fixtures/reducers/copy/01 - copy/07/base.json +39 -0
  50. package/test-fixtures/reducers/copy/01 - copy/07/merged.json +39 -0
  51. package/test-fixtures/reducers/copy/01 - copy/07/metadata.json +5 -0
  52. package/test-fixtures/reducers/copy/01 - copy/07/source.json +24 -0
  53. package/test-fixtures/reducers/copy/01 - copy/08/base.json +28 -0
  54. package/test-fixtures/reducers/copy/01 - copy/08/merged.json +28 -0
  55. package/test-fixtures/reducers/copy/01 - copy/08/metadata.json +4 -0
  56. package/test-fixtures/reducers/copy/01 - copy/08/source.json +24 -0
  57. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/base.json +17 -0
  58. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/merged.json +20 -0
  59. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/metadata.json +6 -0
  60. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/source.json +20 -0
  61. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/base.json +9 -0
  62. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/merged.json +20 -0
  63. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/metadata.json +6 -0
  64. package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/source.json +20 -0
  65. package/test-fixtures/reducers/copy/03 - compareTagsOnly/01/base.json +24 -0
  66. package/test-fixtures/reducers/copy/03 - compareTagsOnly/01/merged.json +24 -0
  67. package/test-fixtures/reducers/copy/03 - compareTagsOnly/01/metadata.json +5 -0
  68. package/test-fixtures/reducers/copy/03 - compareTagsOnly/01/source.json +24 -0
  69. package/test-fixtures/reducers/copy/03 - compareTagsOnly/02/base.json +24 -0
  70. package/test-fixtures/reducers/copy/03 - compareTagsOnly/02/merged.json +100 -0
  71. package/test-fixtures/reducers/copy/03 - compareTagsOnly/02/metadata.json +5 -0
  72. package/test-fixtures/reducers/copy/03 - compareTagsOnly/02/source.json +100 -0
  73. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/base.json +24 -0
  74. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/merged.json +24 -0
  75. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/metadata.json +5 -0
  76. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/source.json +24 -0
  77. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/base.json +24 -0
  78. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/merged.json +39 -0
  79. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/metadata.json +5 -0
  80. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/source.json +24 -0
  81. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/03/metadata.json +6 -0
  82. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/base.json +20 -0
  83. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/merged.json +31 -0
  84. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/metadata.json +5 -0
  85. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/source.json +20 -0
  86. package/test-fixtures/reducers/copy/05 - copyUnless/01/base.json +9 -0
  87. package/test-fixtures/reducers/copy/05 - copyUnless/01/merged.json +24 -0
  88. package/test-fixtures/reducers/copy/05 - copyUnless/01/metadata.json +5 -0
  89. package/test-fixtures/reducers/copy/05 - copyUnless/01/source.json +47 -0
  90. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/base.json +24 -0
  91. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/merged.json +39 -0
  92. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/metadata.json +5 -0
  93. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/source.json +24 -0
  94. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/base.json +24 -0
  95. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/merged.json +24 -0
  96. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/metadata.json +5 -0
  97. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/source.json +24 -0
  98. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/base.json +28 -0
  99. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/merged.json +43 -0
  100. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/metadata.json +5 -0
  101. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/source.json +24 -0
  102. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/base.json +28 -0
  103. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/merged.json +28 -0
  104. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/metadata.json +5 -0
  105. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/source.json +24 -0
  106. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/base.json +20 -0
  107. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/merged.json +35 -0
  108. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/metadata.json +5 -0
  109. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/source.json +24 -0
  110. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/base.json +20 -0
  111. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/merged.json +35 -0
  112. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/metadata.json +5 -0
  113. package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/source.json +24 -0
  114. package/test-fixtures/reducers/copy/07 - excludeSubfields/01/base.json +39 -0
  115. package/test-fixtures/reducers/copy/07 - excludeSubfields/01/merged.json +39 -0
  116. package/test-fixtures/reducers/copy/07 - excludeSubfields/01/metadata.json +8 -0
  117. package/test-fixtures/reducers/copy/{05/source.json → 07 - excludeSubfields/01/source.json } +1 -1
  118. package/test-fixtures/reducers/copy/07 - excludeSubfields/02/base.json +39 -0
  119. package/test-fixtures/reducers/copy/{05/merged.json → 07 - excludeSubfields/02/merged.json } +5 -5
  120. package/test-fixtures/reducers/copy/07 - excludeSubfields/02/metadata.json +5 -0
  121. package/test-fixtures/reducers/copy/07 - excludeSubfields/02/source.json +43 -0
  122. package/test-fixtures/reducers/copy/08 - dropSubfields/01/base.json +35 -0
  123. package/test-fixtures/reducers/copy/08 - dropSubfields/01/merged.json +54 -0
  124. package/test-fixtures/reducers/copy/08 - dropSubfields/01/metadata.json +5 -0
  125. package/test-fixtures/reducers/copy/08 - dropSubfields/01/source.json +43 -0
  126. package/test-fixtures/reducers/copy/08 - dropSubfields/02/base.json +43 -0
  127. package/test-fixtures/reducers/copy/08 - dropSubfields/02/merged.json +58 -0
  128. package/test-fixtures/reducers/copy/08 - dropSubfields/02/metadata.json +5 -0
  129. package/test-fixtures/reducers/copy/08 - dropSubfields/02/source.json +32 -0
  130. package/test-fixtures/reducers/copy/08 - dropSubfields/03/base.json +43 -0
  131. package/test-fixtures/reducers/copy/08 - dropSubfields/03/merged.json +58 -0
  132. package/test-fixtures/reducers/copy/08 - dropSubfields/03/metadata.json +5 -0
  133. package/test-fixtures/reducers/copy/08 - dropSubfields/03/source.json +32 -0
  134. package/test-fixtures/reducers/copy/08 - dropSubfields/04/base.json +43 -0
  135. package/test-fixtures/reducers/copy/08 - dropSubfields/04/merged.json +43 -0
  136. package/test-fixtures/reducers/copy/08 - dropSubfields/04/metadata.json +5 -0
  137. package/test-fixtures/reducers/copy/08 - dropSubfields/04/source.json +32 -0
  138. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/base.json +9 -0
  139. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/merged.json +20 -0
  140. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/metadata.json +6 -0
  141. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/source.json +20 -0
  142. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/base.json +9 -0
  143. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/merged.json +20 -0
  144. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/metadata.json +6 -0
  145. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/source.json +20 -0
  146. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/base.json +9 -0
  147. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/merged.json +31 -0
  148. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/metadata.json +6 -0
  149. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/source.json +31 -0
  150. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/base.json +9 -0
  151. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/merged.json +42 -0
  152. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/metadata.json +6 -0
  153. package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/source.json +42 -0
  154. package/test-fixtures/reducers/copy/10 - swapTag/01/base.json +17 -0
  155. package/test-fixtures/reducers/copy/10 - swapTag/01/merged.json +28 -0
  156. package/test-fixtures/reducers/copy/10 - swapTag/01/metadata.json +6 -0
  157. package/test-fixtures/reducers/copy/10 - swapTag/01/source.json +20 -0
  158. package/test-fixtures/reducers/copy/11 - compareWithoutTag/01/base.json +28 -0
  159. package/test-fixtures/reducers/copy/11 - compareWithoutTag/01/merged.json +28 -0
  160. package/test-fixtures/reducers/copy/11 - compareWithoutTag/01/metadata.json +6 -0
  161. package/test-fixtures/reducers/copy/11 - compareWithoutTag/01/source.json +20 -0
  162. package/test-fixtures/reducers/copy/11 - compareWithoutTag/02/base.json +28 -0
  163. package/test-fixtures/reducers/copy/11 - compareWithoutTag/02/merged.json +39 -0
  164. package/test-fixtures/reducers/copy/11 - compareWithoutTag/02/metadata.json +6 -0
  165. package/test-fixtures/reducers/copy/11 - compareWithoutTag/02/source.json +31 -0
  166. package/test-fixtures/reducers/copy/11 - compareWithoutTag/03/base.json +28 -0
  167. package/test-fixtures/reducers/copy/11 - compareWithoutTag/03/merged.json +28 -0
  168. package/test-fixtures/reducers/copy/11 - compareWithoutTag/03/metadata.json +7 -0
  169. package/test-fixtures/reducers/copy/11 - compareWithoutTag/03/source.json +20 -0
  170. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/base.json +17 -0
  171. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/merged.json +28 -0
  172. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/metadata.json +7 -0
  173. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/source.json +31 -0
  174. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/base.json +28 -0
  175. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/merged.json +28 -0
  176. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/metadata.json +7 -0
  177. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/source.json +28 -0
  178. package/test-fixtures/reducers/metadata.json +4 -0
  179. package/test-fixtures/reducers/select/01/metadata.json +5 -0
  180. package/test-fixtures/reducers/select/02/metadata.json +4 -0
  181. package/test-fixtures/reducers/select/03/metadata.json +4 -0
  182. package/test-fixtures/reducers/select/04/metadata.json +5 -0
  183. package/test-fixtures/reducers/select/05/metadata.json +4 -0
  184. package/test-fixtures/reducers/select/06/base.json +4 -0
  185. package/test-fixtures/reducers/select/06/merged.json +4 -0
  186. package/test-fixtures/reducers/select/06/metadata.json +4 -0
  187. package/test-fixtures/reducers/select/06/source.json +4 -0
  188. package/test-fixtures/reducers/select/07/metadata.json +5 -0
  189. package/test-fixtures/reducers/select/08/metadata.json +4 -0
  190. package/test-fixtures/reducers/select/09/metadata.json +4 -0
  191. package/test-fixtures/reducers/select/10/metadata.json +5 -0
  192. package/test-fixtures/reducers/select/11/metadata.json +4 -0
  193. package/test-fixtures/reducers/select/12/metadata.json +5 -0
  194. package/test-fixtures/reducers/select/13/metadata.json +4 -0
  195. package/test-fixtures/reducers/select/14/base.json +24 -0
  196. package/test-fixtures/reducers/select/14/merged.json +24 -0
  197. package/test-fixtures/reducers/select/14/metadata.json +4 -0
  198. package/test-fixtures/reducers/select/14/source.json +24 -0
  199. package/.drone.yml +0 -92
  200. package/.nyc_output/7ecda3cd-9f84-4416-a466-fa1e5889c6a3.json +0 -1
  201. package/.nyc_output/processinfo/7ecda3cd-9f84-4416-a466-fa1e5889c6a3.json +0 -1
  202. package/.nyc_output/processinfo/index.json +0 -1
  203. package/LICENSE.txt +0 -165
  204. package/coverage/base.css +0 -224
  205. package/coverage/block-navigation.js +0 -79
  206. package/coverage/copy.js.html +0 -344
  207. package/coverage/favicon.png +0 -0
  208. package/coverage/index.html +0 -126
  209. package/coverage/lcov-report/base.css +0 -224
  210. package/coverage/lcov-report/block-navigation.js +0 -79
  211. package/coverage/lcov-report/copy.js.html +0 -344
  212. package/coverage/lcov-report/favicon.png +0 -0
  213. package/coverage/lcov-report/index.html +0 -126
  214. package/coverage/lcov-report/prettify.css +0 -1
  215. package/coverage/lcov-report/prettify.js +0 -2
  216. package/coverage/lcov-report/select.js.html +0 -431
  217. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  218. package/coverage/lcov-report/sorter.js +0 -170
  219. package/coverage/lcov.info +0 -195
  220. package/coverage/prettify.css +0 -1
  221. package/coverage/prettify.js +0 -2
  222. package/coverage/select.js.html +0 -431
  223. package/coverage/sort-arrow-sprite.png +0 -0
  224. package/coverage/sorter.js +0 -170
  225. package/test-fixtures/reducers/copy/01/pattern.txt +0 -1
  226. package/test-fixtures/reducers/copy/02/pattern.txt +0 -1
  227. package/test-fixtures/reducers/copy/03/pattern.txt +0 -1
  228. package/test-fixtures/reducers/copy/04/pattern.txt +0 -1
  229. package/test-fixtures/reducers/copy/05/pattern.txt +0 -1
  230. package/test-fixtures/reducers/select/01/expected-error.txt +0 -1
  231. package/test-fixtures/reducers/select/01/pattern.txt +0 -1
  232. package/test-fixtures/reducers/select/02/pattern.txt +0 -1
  233. package/test-fixtures/reducers/select/03/pattern.txt +0 -1
  234. package/test-fixtures/reducers/select/04/pattern.txt +0 -1
  235. package/test-fixtures/reducers/select/05/pattern.txt +0 -1
  236. package/test-fixtures/reducers/select/06/pattern.txt +0 -1
  237. package/test-fixtures/reducers/select/07/equalityFunction.txt +0 -1
  238. package/test-fixtures/reducers/select/07/pattern.txt +0 -1
  239. package/test-fixtures/reducers/select/08/pattern.txt +0 -1
  240. package/test-fixtures/reducers/select/09/pattern.txt +0 -1
  241. package/test-fixtures/reducers/select/10/equalityFunction.txt +0 -1
  242. package/test-fixtures/reducers/select/10/pattern.txt +0 -1
  243. package/test-fixtures/reducers/select/11/pattern.txt +0 -1
  244. package/test-fixtures/reducers/select/12/equalityFunction.txt +0 -1
  245. package/test-fixtures/reducers/select/12/pattern.txt +0 -1
  246. package/test-fixtures/reducers/select/13/pattern.txt +0 -1
@@ -1,88 +1,251 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Merge MARC records
6
- *
7
- * Copyright (C) 2015-2019 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-merge-js
10
-
11
- * marc-record-merge-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-merge-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
- // Import createDebugLogger from 'debug';
29
-
30
- export default (pattern) => (base, source) => {
31
- // Const debug = createDebugLogger('@natlibfi/marc-record-merge');
32
- const baseFields = base.get(pattern);
33
- const sourceFields = source.get(pattern);
34
- return copyFields();
35
-
36
- function copyFields() {
37
- // Test 01: If base does not contain the field at all, it is copied from source to base
38
- if (baseFields.length === 0) {
39
- sourceFields.forEach(f => base.insertField(f));
40
- return base;
1
+ /* eslint-disable max-statements */
2
+ /* eslint-disable no-unused-vars */
3
+
4
+ import {MarcRecord} from '@natlibfi/marc-record';
5
+ import createDebugLogger from 'debug';
6
+
7
+ export default ({
8
+ tagPattern,
9
+ compareTagsOnly = false,
10
+ compareWithoutTag = false,
11
+ compareWithoutIndicators = false,
12
+ compareWithoutIndicator1 = false,
13
+ compareWithoutIndicator2 = false,
14
+ subfieldsMustBeIdentical = true,
15
+ excludeSubfields = [],
16
+ dropSubfields = [],
17
+ copyUnless = [],
18
+ baseValidators = {subfieldValues: false},
19
+ sourceValidators = {subfieldValues: false},
20
+ swapTag = [],
21
+ swapSubfieldCode = [],
22
+ doNotCopyIfFieldPresent = false
23
+ }) => (base, source) => {
24
+ const baseRecord = new MarcRecord(base, baseValidators);
25
+ const sourceRecord = new MarcRecord(source, sourceValidators);
26
+
27
+ const debug = createDebugLogger('@natlibfi/marc-record-merge');
28
+ const debugOptions = createDebugLogger('@natlibfi/marc-record-merge:compare-options');
29
+ const debugCompare = createDebugLogger('@natlibfi/marc-record-merge:compare');
30
+
31
+ const ignoreInd1 = compareWithoutIndicators || compareWithoutIndicator1;
32
+ const ignoreInd2 = compareWithoutIndicators || compareWithoutIndicator2;
33
+
34
+ debugOptions(`Tag Pattern: ${tagPattern}`);
35
+ debugOptions(`Compare tags only: ${compareTagsOnly}`);
36
+ debugOptions(`Omit indicator 1 from comparison: ${ignoreInd1}`);
37
+ debugOptions(`Omit indicator 2 from comparison: ${ignoreInd2}`);
38
+ debugOptions(`Copy if identical: ${subfieldsMustBeIdentical}`);
39
+ debugOptions(`Exclude subfields: [${excludeSubfields}]`);
40
+ debugOptions(`Drop subfields [${dropSubfields}]`);
41
+ debugOptions(`Copy unless contains subfields: ${JSON.stringify(copyUnless)}`);
42
+
43
+ const baseFields = baseRecord.get(tagPattern);
44
+ const sourceFields = sourceRecord.get(tagPattern);
45
+ const doNotCopy = doNotCopyIfFieldPresent ? baseRecord.get(doNotCopyIfFieldPresent).length > 0 : false;
46
+
47
+ if (doNotCopy) {
48
+ return baseRecord.toObject();
49
+ }
50
+ debug(`FFS: ${compareWithoutIndicator1}, ${compareWithoutIndicators}, ${ignoreInd1}`);
51
+ debug(`Base fields: `, baseFields);
52
+ debug(`Source fields: `, sourceFields);
53
+
54
+ // Logic steps
55
+ const baseCompareFields = baseFields.map(baseField => createCompareField(baseField));
56
+ const compareResultFields = compareFields(sourceFields, baseCompareFields);
57
+ const droppedUnwantedSubfield = checkDropSubfields(compareResultFields);
58
+ const droppedUnwantedFields = checkCopyUnlessFields(droppedUnwantedSubfield);
59
+ const swappedSubfields = checkSwapSubfieldCodes(droppedUnwantedFields);
60
+ const swappedTags = checkSwapTag(swappedSubfields);
61
+ const uniqueFields = [...new Set(swappedTags.map(field => JSON.stringify(field)))].map(field => JSON.parse(field));
62
+ debug('Fields to be copied');
63
+ debug(JSON.stringify(uniqueFields));
64
+
65
+ // Add fields to base;
66
+ uniqueFields.forEach(field => baseRecord.insertField(field));
67
+ return baseRecord.toObject();
68
+
69
+ function compareFields(sourceFields, baseCompareFields, uniqFields = []) {
70
+ const [sourceField, ...rest] = sourceFields;
71
+ if (sourceField === undefined) {
72
+ return uniqFields;
41
73
  }
42
- const filterMissing = function(sourceField) {
43
- // Test 02: Identical control fields are not copied
44
- if ('value' in sourceField) {
45
- return baseFields.some(isIdenticalControlField) === false;
46
- }
47
- // Test 04: Identical data fields in base and source, not copied
48
- // Test 05: Different data fields are copied from source to base
49
- if ('subfields' in sourceField) {
50
- return baseFields.some(isIdenticalDataField) === false;
51
- }
52
74
 
53
- function normalizeControlField(field) {
54
- return field.value.toLowerCase().replace(/\s+/u, '');
55
- }
75
+ if (baseCompareFields.length === 0) {
76
+ return compareFields(rest, baseCompareFields, [...uniqFields, sourceField]);
77
+ }
56
78
 
57
- function isIdenticalControlField(baseField) {
58
- const normalizedBaseField = normalizeControlField(baseField);
59
- const normalizedSourceField = normalizeControlField(sourceField);
60
- return normalizedSourceField === normalizedBaseField;
61
- }
62
- function isIdenticalDataField(baseField) {
63
- if (sourceField.tag === baseField.tag &&
64
- sourceField.ind1 === baseField.ind1 &&
65
- sourceField.ind2 === baseField.ind2 &&
66
- sourceField.subfields.length === baseField.subfields.length) {
67
- return baseField.subfields.every(isIdenticalSubfield);
79
+ // Source and base are also compared for identicalness
80
+ // Non-identical fields are copied from source to base as duplicates
81
+ const sourceCompareField = createCompareField(sourceField);
82
+ const unique = checkCompareFields(baseCompareFields, sourceCompareField);
83
+
84
+ debugCompare(`${JSON.stringify(sourceField)} ${unique ? 'is UNIQUE' : 'not UNIQUE'}`);
85
+
86
+ if (unique) {
87
+ return compareFields(rest, baseCompareFields, [...uniqFields, sourceField]);
88
+ }
89
+
90
+ return compareFields(rest, baseCompareFields, uniqFields);
91
+
92
+ function checkCompareFields(baseCompareFields, sourceCompareField) {
93
+ let unique = true; // eslint-disable-line functional/no-let
94
+
95
+ baseCompareFields.forEach(baseCompareField => {
96
+ debugCompare(`Comparing ${JSON.stringify(sourceCompareField)} to ${JSON.stringify(baseCompareField)}}`);
97
+
98
+ if (sourceCompareField.value !== baseCompareField.value) {
99
+ debugCompare(`Value is different ${sourceCompareField.value} !== ${baseCompareField.value}`);
100
+ return;
101
+ }
102
+
103
+ if (sourceCompareField.ind1 !== baseCompareField.ind1) {
104
+ debugCompare(`Ind1 is different ${sourceCompareField.ind1} !== ${baseCompareField.ind1}`);
105
+ return;
68
106
  }
69
- function normalizeSubfield(subfield) {
70
- return subfield.value.toLowerCase().replace(/\s+/u, '');
107
+
108
+ if (sourceCompareField.ind2 !== baseCompareField.ind2) {
109
+ debugCompare(`Ind2 is different ${sourceCompareField.ind2} !== ${baseCompareField.ind2}`);
110
+ return;
71
111
  }
72
- function isIdenticalSubfield(baseSub) {
73
- const normBaseSub = normalizeSubfield(baseSub);
74
- return sourceField.subfields.some(sourceSub => {
75
- const normSourceSub = normalizeSubfield(sourceSub);
76
- return normSourceSub === normBaseSub;
77
- });
112
+
113
+ if ('subfields' in sourceCompareField) {
114
+ const allFound = checkSubfields(sourceCompareField.subfields, baseCompareField.subfields);
115
+ debugCompare(`Subfields are different ${!allFound}`);
116
+ if (!allFound) {
117
+ return;
118
+ }
119
+
120
+ unique = false;
121
+ return;
78
122
  }
123
+
124
+ unique = false;
125
+ return;
126
+ });
127
+
128
+ return unique;
129
+ }
130
+
131
+ function checkSubfields(sourceSubfields, baseSubfields) {
132
+ const foundSubs = sourceSubfields.filter(sSub => baseSubfields.some(bSub => sSub.code === bSub.code && sSub.value === bSub.value));
133
+
134
+ if (subfieldsMustBeIdentical) {
135
+ return foundSubs.length === sourceSubfields.length && foundSubs.length === baseSubfields.length;
79
136
  }
80
- };
81
- // Search for fields missing from base
82
- const missingFields = sourceFields.filter(filterMissing);
83
- // Test 03: Add missing control field to base
84
- // Test 05: Add missing data field to base
85
- missingFields.forEach(f => base.insertField(f));
86
- return base; // This is returned by copyFields
137
+
138
+ return foundSubs.length === sourceSubfields.length;
139
+ }
140
+ }
141
+
142
+ // compare objects have only fields that matter in comparison
143
+ function createCompareField(field) {
144
+ if (compareTagsOnly) {
145
+ return {tag: field.tag};
146
+ }
147
+
148
+ if ('value' in field) {
149
+ return {tag: field.tag, value: field.value};
150
+ }
151
+
152
+ const [filteredField] = checkDropSubfields([field]);
153
+ const [foundRule] = swapTag.filter(rule => new RegExp(rule.from, 'u').test(field.tag));
154
+ const replacementTag = foundRule ? foundRule.to : undefined;
155
+
156
+ const params = [
157
+ {name: 'tag', value: compareWithoutTag ? replacementTag : field.tag},
158
+ {name: 'ind1', value: ignoreInd1 ? undefined : field.ind1},
159
+ {name: 'ind2', value: ignoreInd2 ? undefined : field.ind2},
160
+ {name: 'subfields', value: createCompareSubfields(filteredField.subfields)}
161
+ ].map(param => [param.name, param.value]);
162
+
163
+ return Object.fromEntries(params);
164
+
165
+ function createCompareSubfields(subfields) {
166
+ const nonExcludedSubfields = subfields.filter(sub => !excludeSubfields.some(code => code === sub.code));
167
+ const normalizedSubfields = nonExcludedSubfields.map(sub => ({code: sub.code, value: normalizeSubfieldValue(sub.value)}));
168
+
169
+ return normalizedSubfields;
170
+
171
+ function normalizeSubfieldValue(value) {
172
+ return value.toLowerCase().replace(/\s+/ug, '');
173
+ }
174
+ }
175
+ }
176
+
177
+ function checkSwapTag(fields) {
178
+ if (swapTag.length > 0) {
179
+ return fields.map(field => ({...field, tag: swapTagsFunc(field.tag)}));
180
+ }
181
+
182
+ return fields;
183
+
184
+ function swapTagsFunc(tag) {
185
+ const [foundRule] = swapTag.filter(rule => new RegExp(rule.from, 'u').test(tag));
186
+
187
+ if (foundRule === undefined) {
188
+ return tag;
189
+ }
190
+
191
+ return foundRule.to;
192
+ }
193
+ }
194
+
195
+ function checkSwapSubfieldCodes(fields) {
196
+ if (swapSubfieldCode.length > 0) {
197
+ return fields.map(field => ({...field, subfields: swapSubfieldCodesFunc(field.subfields)}));
198
+ }
199
+
200
+ return fields;
201
+
202
+ function swapSubfieldCodesFunc(subfields) {
203
+ return subfields.map(sub => {
204
+ const [foundRule] = swapSubfieldCode.filter(rule => rule.from === sub.code);
205
+
206
+ if (foundRule === undefined) {
207
+ return sub;
208
+ }
209
+
210
+ return {code: foundRule.to, value: sub.value};
211
+ });
212
+ }
213
+ }
214
+
215
+ function checkDropSubfields(fields) {
216
+ if (dropSubfields.length > 0) {
217
+ return fields.map(field => ({...field, subfields: dropSubfieldsFunc(field.subfields)}))
218
+ .filter(field => field.subfields.length > 0);
219
+ }
220
+
221
+ return fields;
222
+
223
+ function dropSubfieldsFunc(subfields) {
224
+ return subfields.filter(sub => { // eslint-disable-line
225
+ return !dropSubfields.some(({code, value = false, condition = false}) => {
226
+ if (code !== sub.code) {
227
+ return false;
228
+ }
229
+
230
+ if (!condition && value) {
231
+ return value === sub.value;
232
+ }
233
+
234
+ if (condition === 'unless' && value) {
235
+ return !new RegExp(value, 'u').test(sub.value);
236
+ }
237
+
238
+ return true;
239
+ });
240
+ });
241
+ }
242
+ }
243
+
244
+ function checkCopyUnlessFields(fields) {
245
+ if (copyUnless.length > 0) {
246
+ return fields.filter(({subfields}) => copyUnless.some(filter => !subfields.some(sub => sub.code === filter.code && new RegExp(filter.value, 'u').test(sub.value))));
247
+ }
248
+
249
+ return fields;
87
250
  }
88
251
  };
@@ -1,52 +1,54 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Merge MARC records
6
- *
7
- * Copyright (C) 2015-2019 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-merge-js
10
-
11
- * marc-record-merge-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-merge-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
- import chai from 'chai';
29
- import fs from 'fs';
30
- import path from 'path';
31
- import {MarcRecord} from '@natlibfi/marc-record';
1
+ import {expect} from 'chai';
2
+ import {READERS} from '@natlibfi/fixura';
32
3
  import createReducer from './copy';
33
- import fixturesFactory, {READERS} from '@natlibfi/fixura';
34
-
35
- MarcRecord.setValidationOptions({subfieldValues: false});
4
+ import generateTests from '@natlibfi/fixugen';
36
5
 
37
- describe('reducers/copy', () => {
38
- const {expect} = chai;
39
- const fixturesPath = path.join(__dirname, '..', '..', 'test-fixtures', 'reducers', 'copy');
6
+ //import createDebugLogger from 'debug'; // <---
7
+ //const debug = createDebugLogger('@natlibfi/marc-record-merge/copy.spec.js'); // <---
40
8
 
41
- fs.readdirSync(fixturesPath).forEach(subDir => {
42
- const {getFixture} = fixturesFactory({root: [fixturesPath, subDir], reader: READERS.JSON});
43
- it(subDir, () => {
44
- const baseTest = new MarcRecord(getFixture('base.json'));
45
- const sourceTest = new MarcRecord(getFixture('source.json'));
46
- const patternTest = new RegExp(getFixture({components: ['pattern.txt'], reader: READERS.TEXT}), 'u');
47
- const expectedRecord = getFixture('merged.json');
48
- const mergedRecord = createReducer(patternTest)(baseTest, sourceTest);
49
- expect(mergedRecord.toObject()).to.eql(expectedRecord);
50
- });
51
- });
9
+ generateTests({
10
+ callback,
11
+ path: [__dirname, '..', '..', 'test-fixtures', 'reducers', 'copy'],
12
+ useMetadataFile: true,
13
+ recurse: true,
14
+ fixura: {
15
+ reader: READERS.JSON,
16
+ failWhenNotFound: false
17
+ }
52
18
  });
19
+
20
+ function callback({
21
+ getFixture,
22
+ tagPatternRegExp,
23
+ compareTagsOnly = false,
24
+ compareWithoutTag = false,
25
+ compareWithoutIndicators = false,
26
+ compareWithoutIndicator1 = false,
27
+ compareWithoutIndicator2 = false,
28
+ subfieldsMustBeIdentical = false,
29
+ copyUnless = undefined,
30
+ excludeSubfields = undefined,
31
+ dropSubfields = undefined,
32
+ swapSubfieldCode = [],
33
+ swapTag = [],
34
+ doNotCopyIfFieldPresent = false
35
+ }) {
36
+ const base = getFixture('base.json');
37
+ const source = getFixture('source.json');
38
+ const tagPattern = new RegExp(tagPatternRegExp, 'u');
39
+ const expectedRecord = getFixture('merged.json');
40
+
41
+ const merged = createReducer({
42
+ tagPattern, compareTagsOnly, compareWithoutTag, compareWithoutIndicators, compareWithoutIndicator1, compareWithoutIndicator2,
43
+ copyUnless, subfieldsMustBeIdentical, excludeSubfields,
44
+ dropSubfields, swapSubfieldCode, swapTag,
45
+ doNotCopyIfFieldPresent
46
+ })(base, source);
47
+ //debug(`*** mergedRecord: `, mergedRecord); //<--
48
+ //debug(`*** mergedRecord,Strfy: `, JSON.stringify(mergedRecord)); //<--
49
+ //debug(`*** expectedRecord: `, expectedRecord); //<--
50
+ //debug(`*** expectedRecord,Strfy: `, JSON.stringify(expectedRecord)); //<--
51
+ expect(merged.constructor.name).not.to.eql('MarcRecord');
52
+ expect(merged.constructor.name).to.eql('Object');
53
+ expect(merged).to.eql(expectedRecord);
54
+ }
@@ -1,31 +1,4 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Merge MARC records
6
- *
7
- * Copyright (C) 2015-2019 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-merge-js
10
-
11
- * marc-record-merge-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-merge-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
- export * from './copy';
30
- export * from './select';
1
+ import copy from './copy';
2
+ import select, {strictEquality, subsetEquality} from './select';
31
3
 
4
+ export default {copy, select, strictEquality, subsetEquality};
@@ -1,56 +1,40 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Merge MARC records
6
- *
7
- * Copyright (C) 2015-2019 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-merge-js
10
-
11
- * marc-record-merge-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-merge-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
  import {normalizeSync} from 'normalize-diacritics';
2
+ import createDebugLogger from 'debug';
3
+ import {MarcRecord} from '@natlibfi/marc-record';
29
4
 
30
5
  export function strictEquality(subfieldA, subfieldB) {
31
6
  return subfieldA.code === subfieldB.code &&
32
- subfieldA.value === subfieldB.value;
7
+ subfieldA.value === subfieldB.value;
33
8
  }
34
9
 
35
10
  export function subsetEquality(subfieldA, subfieldB) {
36
11
  return subfieldA.code === subfieldB.code &&
37
- (subfieldA.value.indexOf(subfieldB.value) !== -1 || subfieldB.value.indexOf(subfieldA.value) !== -1);
12
+ (subfieldA.value.indexOf(subfieldB.value) !== -1 || subfieldB.value.indexOf(subfieldA.value) !== -1);
38
13
  }
39
-
40
- export default ({pattern, equalityFunction = strictEquality}) => (base, source) => {
41
- const baseFields = base.get(pattern);
42
- const sourceFields = source.get(pattern);
14
+ // EqualityFunction can be either strictEquality or subsetEquality
15
+ export default ({tagPattern, equalityFunction = strictEquality}) => (base, source) => {
16
+ const debug = createDebugLogger('@natlibfi/marc-record-merge:select');
17
+ const baseRecord = new MarcRecord(base, {subfieldValues: false});
18
+ const sourceRecord = new MarcRecord(source, {subfieldValues: false});
19
+ const baseFields = baseRecord.get(tagPattern);
20
+ const sourceFields = sourceRecord.get(tagPattern);
21
+ const fieldTag = sourceFields.map(field => field.tag);
22
+ debug(`Comparing field ${fieldTag}`);
43
23
 
44
24
  checkFieldType(baseFields);
45
25
  checkFieldType(sourceFields);
46
26
 
47
27
  if (baseFields.length > 1 || sourceFields.length > 1) {
28
+ debug(`Multiple fields in base or source`);
29
+ debug(`No changes to base`);
48
30
  return base;
49
31
  }
50
32
  const [baseField] = baseFields;
51
33
  const [sourceField] = sourceFields;
52
34
 
53
35
  if (baseField.tag === sourceField.tag === false) {
36
+ debug(`Base tag ${baseField.tag} is not equal to source tag ${sourceField.tag}`);
37
+ debug(`No changes to base`);
54
38
  return base;
55
39
  }
56
40
  const baseSubs = baseField.subfields;
@@ -62,19 +46,26 @@ export default ({pattern, equalityFunction = strictEquality}) => (base, source)
62
46
  const sourceSubsNormalized = sourceSubs
63
47
  .map(({code, value}) => ({code, value: normalizeSubfieldValue(value)}));
64
48
 
49
+ // Returns the base subfields for which a matching source subfield is found
65
50
  const equalSubfieldsBase = baseSubsNormalized
66
51
  .filter(baseSubfield => sourceSubsNormalized
67
52
  .some(sourceSubfield => equalityFunction(baseSubfield, sourceSubfield)));
53
+ debug(`equalSubfieldsBase: ${JSON.stringify(equalSubfieldsBase, undefined, 2)}`);
68
54
 
55
+ // Returns the source subfields for which a matching base subfield is found
69
56
  const equalSubfieldsSource = sourceSubsNormalized
70
57
  .filter(sourceSubfield => baseSubsNormalized
71
58
  .some(baseSubfield => equalityFunction(sourceSubfield, baseSubfield)));
59
+ debug(`equalSubfieldsSource: ${JSON.stringify(equalSubfieldsSource, undefined, 2)}`);
72
60
 
73
61
  if (baseSubs.length === sourceSubs.length && equalSubfieldsBase.length < baseSubs.length) {
62
+ debug(`Base and source subfields are not equal`);
63
+ debug(`No changes to base`);
74
64
  return base;
75
65
  }
76
66
 
77
67
  if (baseSubs.length === sourceSubs.length && equalSubfieldsBase.length === equalSubfieldsSource.length) {
68
+ debug(`Checking subfield equality`);
78
69
  const totalSubfieldLengthBase = baseSubsNormalized
79
70
  .map(({value}) => value.length)
80
71
  .reduce((acc, value) => acc + value);
@@ -91,11 +82,13 @@ export default ({pattern, equalityFunction = strictEquality}) => (base, source)
91
82
  return replaceBasefieldWithSourcefield(base);
92
83
  }
93
84
 
85
+ debug(`No changes to base`);
94
86
  return base;
95
87
 
96
88
  function replaceBasefieldWithSourcefield(base) {
97
89
  const index = base.fields.findIndex(field => field === baseField);
98
90
  base.fields.splice(index, 1, sourceField); // eslint-disable-line functional/immutable-data
91
+ debug(`Source field is longer, replacing base with source`);
99
92
  return base;
100
93
  }
101
94
 
@@ -111,7 +104,7 @@ export default ({pattern, equalityFunction = strictEquality}) => (base, source)
111
104
 
112
105
  function normalizeSubfieldValue(value) {
113
106
  // Regexp options: g: global search, u: unicode
114
- const punctuation = /[.,\-/#!$%^&*;:{}=_`~()[\]]/gu;
107
+ const punctuation = /[.,\-/#!?$%^&*;:{}=_`~()[\]]/gu;
115
108
  return normalizeSync(value).toLowerCase().replace(punctuation, '', 'u').replace(/\s+/gu, ' ').trim();
116
109
  }
117
110
  };