@iebh/polyglot 4.9.4 → 4.9.6

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,57 +138,31 @@ 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-9])\b/i.exec(q)) {
142
+ q = q.replace(/([^ \t])(\$[1-9])\b/g, '$1 $2');
143
+ }
144
+ if (match = /^(\$1)\b/i.exec(q)) {
145
+ // $1
143
146
  branch.nodes.push({
144
- type: 'dollarOtherNum',
145
- ref: [match[2]],
146
- cond: '',
147
+ type: 'dollarOne',
148
+ ref: [match[0]],
149
+ cond: match[0] ? match[0].toUpperCase() : '',
147
150
  nodes: []
148
151
  });
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;
152
+ offset += match[0].length;
153
+ q = q.substr(match[0].length);
173
154
  cropString = false;
155
+ } else if (match = /^(\$[2-9])\b/i.exec(q)) {
156
+ // $2, $3 ... $9
174
157
  branch.nodes.push({
175
- type: 'dollarOtherNum',
176
- ref: [match[3]],
177
- cond: '',
178
- nodes: []
179
- });
180
- offset += match[1].length;
181
- q = q.substr(match[1].length);
182
- } else if (match = /(\$1)\b/i.exec(q)) {
183
- // $1
184
- branch.nodes.push({
185
- type: 'dollarOne',
158
+ type: 'dollarNum',
186
159
  ref: [match[0]],
160
+ value: match[0],
187
161
  cond: match[0] ? match[0].toUpperCase() : '',
188
162
  nodes: []
189
163
  });
190
- offset += match.index + match[0].length;
191
- q = q.substr(match.index + match[0].length);
164
+ offset += match[0].length;
165
+ q = q.substr(match[0].length);
192
166
  cropString = false;
193
167
  } else if (/^\(/.test(q)) {
194
168
  var newGroup = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/polyglot",
3
- "version": "4.9.4",
3
+ "version": "4.9.6",
4
4
  "description": "IEBH-SRA tool to convert between different medical database search formats",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {