-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from jillix/registry-ready
Registry ready
- Loading branch information
Showing
9 changed files
with
104 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = function (scope, inst, args, data, next) { | ||
module.exports = () => { | ||
// TODO how to know, when to call next? | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
var libob = require('libobject'); | ||
var jsonLogic = require('json-logic-js'); | ||
'use strict'; | ||
|
||
module.exports = function (scope, inst, options, data, next) { | ||
const libob = require('libobject'); | ||
const jsonLogic = require('json-logic-js'); | ||
|
||
module.exports = (options, data, callback) => { | ||
|
||
if (!libob.isObject(options) || !libob.isObject(data)) { | ||
return next(new Error('Flow-tools.logic: Options or data is not an object.')); | ||
return callback(new Error('Flow-tools.logic: Options or data is not an object.')); | ||
} | ||
|
||
// do logic for multiple keys | ||
Object.keys(options).forEach(function (key) { | ||
data[key] = jsonLogic.apply(options[key], data); | ||
}); | ||
|
||
next(null, data); | ||
}; | ||
callback(null, data); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
module.exports = function (scope, inst, options, data, next, stream) { | ||
module.exports = (data, stream, callback) => { | ||
|
||
// data must be an array | ||
if (!(data instanceof Array)) { | ||
return next(new Error('Flow-tool.slice: Data chunk must be an array.')); | ||
return callback(new Error('Flow-tool.slice: Data chunk must be an array.')); | ||
} | ||
|
||
if (!data.length) { | ||
return next(new Error('Flow-tool.slice: Data chunk must be a non empty array')); | ||
return callback(new Error('Flow-tool.slice: Data chunk must be a non empty array')); | ||
} | ||
|
||
var lastItem = data.pop(); | ||
data.forEach(function (item) { | ||
let lastItem = data.pop(); | ||
data.forEach(item => { | ||
stream.push(item); | ||
}); | ||
next(null, lastItem); | ||
callback(null, lastItem); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.