@iebh/polyglot 4.9.3 → 4.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -322,7 +322,6 @@ var _default = {
322
322
  buffer += branch.content;
323
323
  break;
324
324
  case 'dollarOne':
325
- console.log("Here1", branch, engine, buffer);
326
325
  switch (engine) {
327
326
  case 'PubMed full':
328
327
  case 'PubMed abbreviation':
@@ -353,6 +352,38 @@ var _default = {
353
352
  break;
354
353
  }
355
354
  break;
355
+ case 'dollarNum':
356
+ console.log("Here1", branch, engine, buffer);
357
+ switch (engine) {
358
+ case 'PubMed full':
359
+ case 'PubMed abbreviation':
360
+ case 'Lilacs':
361
+ case 'Scopus (basic search)':
362
+ case 'Scopus (advanced search)':
363
+ case 'International HTA Database':
364
+ buffer += '*';
365
+ break;
366
+ case 'Ovid MEDLINE':
367
+ buffer += branch.value;
368
+ break;
369
+ case 'Cochrane Library':
370
+ case 'PsycInfo (Ovid)':
371
+ case 'ProQuest Health and Medical':
372
+ buffer += '*';
373
+ break;
374
+ case 'Embase (Elsevier)':
375
+ case 'Web of Science':
376
+ case 'WoS Advanced':
377
+ buffer += '*';
378
+ break;
379
+ case 'CINAHL (Ebsco)':
380
+ case 'SPORTDiscus':
381
+ case 'Business Source Ultimate':
382
+ case 'PsycInfo (Ebsco)':
383
+ buffer += '*';
384
+ break;
385
+ }
386
+ break;
356
387
  case 'template':
357
388
  console.log("Here2", branch.content, engine, buffer);
358
389
  buffer += _tools["default"].resolveTemplate(branch.content, engine);
@@ -138,47 +138,29 @@ var parse = function parse(query, options) {
138
138
  while (q.length) {
139
139
  var cropString = true; // Whether to remove one charcater from the beginning of the string (set to false if the lexical match handles this behaviour itself)
140
140
  var match;
141
- if (match = /^(\$([2-9]+)) +(AND|OR|NOT)\s+/i.exec(q)) {
142
- // $2 AND
141
+ if (match = /^(\$1)\b/i.exec(q)) {
142
+ // $1
143
143
  branch.nodes.push({
144
- type: 'dollarOtherNum',
145
- ref: [match[2]],
146
- cond: '',
144
+ type: 'dollarOne',
145
+ ref: [match[0]],
146
+ cond: match[0] ? match[0].toUpperCase() : '',
147
147
  nodes: []
148
148
  });
149
- offset += match[1].length;
150
- q = q.substr(match[1].length);
151
- cropString = false;
152
- } else if (match = /^(AND|OR|NOT) +\$([2-9]+)\b/i.exec(q)) {
153
- // AND 2$...
154
- trimLastLeaf();
155
- switch (match[2].toLowerCase()) {
156
- case "and":
157
- branch.nodes.push({
158
- type: 'joinAnd'
159
- });
160
- break;
161
- case "or":
162
- branch.nodes.push({
163
- type: 'joinOr'
164
- });
165
- break;
166
- case "not":
167
- branch.nodes.push({
168
- type: 'joinNot'
169
- });
170
- break;
171
- }
172
- leaf = undefined;
149
+ offset += match[0].length;
150
+ q = q.substr(match[0].length);
173
151
  cropString = false;
152
+ } else if (match = /^(\$[2-9])\b/i.exec(q)) {
153
+ // $2, $3 ... $9
174
154
  branch.nodes.push({
175
- type: 'dollarOtherNum',
176
- ref: [match[3]],
177
- cond: '',
155
+ type: 'dollarNum',
156
+ ref: [match[0]],
157
+ value: match[0],
158
+ cond: match[0] ? match[0].toUpperCase() : '',
178
159
  nodes: []
179
160
  });
180
- offset += match[1].length;
181
- q = q.substr(match[1].length);
161
+ offset += match[0].length;
162
+ q = q.substr(match[0].length);
163
+ cropString = false;
182
164
  } else if (/^\(/.test(q)) {
183
165
  var newGroup = {
184
166
  type: 'group',
@@ -575,20 +557,6 @@ var parse = function parse(query, options) {
575
557
  offset += match[0].length;
576
558
  q = q.substr(match[0].length);
577
559
  cropString = false;
578
- } else if (match = /(\$1)\b/i.exec(q)) {
579
- // $1
580
- branch.nodes.push({
581
- type: 'dollarOne',
582
- ref: [match[2]],
583
- cond: match[2] ? match[2].toUpperCase() : '',
584
- nodes: []
585
- });
586
- var index = q.indexOf(match[0]);
587
- if (index !== -1) {
588
- offset += index + 2;
589
- q = q.slice(0, index) + q.slice(index + 2);
590
- cropString = false;
591
- }
592
560
  }
593
561
  // }}}
594
562
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/polyglot",
3
- "version": "4.9.3",
3
+ "version": "4.9.5",
4
4
  "description": "IEBH-SRA tool to convert between different medical database search formats",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {