1 | import OBJ from 'dot-prop';
|
2 | import { newValue } from './utils';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function ISTEXResult(data, feed) {
|
16 | if (this.isLast()) {
|
17 | return feed.close();
|
18 | }
|
19 | const source = this.getParam('source');
|
20 | const target = this.getParam('target');
|
21 | const handle = source ? OBJ.get(data, source) : data;
|
22 |
|
23 | const result = handle.hits || [];
|
24 | result.forEach((hitObj) => {
|
25 | feed.write(newValue({ ...hitObj }, target, data));
|
26 | });
|
27 | feed.end();
|
28 | }
|
29 |
|
30 | export default {
|
31 | ISTEXResult,
|
32 | };
|