Skip to content

Commit 3d33515

Browse files
authored
Merge pull request #20 from elasticio/add-eslint
Install ESLint and fix formatting
2 parents 0c4a7ea + 6e42597 commit 3d33515

File tree

9 files changed

+1005
-691
lines changed

9 files changed

+1005
-691
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## 1.0.2 (September 18, 2019)
2+
3+
* Initial release
4+
* Add "Split on JSONata Expression" action
5+
* Deprecate "Split Message By Array" action
6+
* Format repository according to Airbnb styling

lib/actions/splitOnJsonata.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
'use strict';
2-
31
const debug = require('debug')('splitter');
42
const _ = require('lodash');
53
const { JsonataTransform } = require('@elastic.io/component-commons-library');
6-
const messages = require('elasticio-node').messages;
4+
const { messages } = require('elasticio-node');
75

86
/**
97
* @this processAction
@@ -16,19 +14,19 @@ async function processAction(msg, cfg) {
1614
return;
1715
}
1816

19-
if (_.find(split, elem => !_.isObject(elem))) {
17+
if (_.find(split, (elem) => !_.isObject(elem))) {
2018
await this.emit('error', new Error('Splitting arrays of objects only!'));
2119
return;
2220
}
2321

2422
const results = [];
25-
split.forEach(elem => results.push(elem));
23+
split.forEach((elem) => results.push(elem));
2624
debug('%s parts to emit found', results.length);
27-
for (let value of results) {
28-
if (value) {
29-
await this.emit('data', messages.newMessageWithBody(value));
25+
results.forEach(async (result) => {
26+
if (result) {
27+
await this.emit('data', messages.newMessageWithBody(result));
3028
}
31-
}
29+
});
3230
await this.emit('end');
3331
}
3432

0 commit comments

Comments
 (0)