Skip to content

Instantly share code, notes, and snippets.

@jnv
Last active Oct 26, 2018
Embed
What would you like to do?
BakeryJS Example Component (wordcount)
const {boxFactory} = require('bakeryjs');
module.exports = boxFactory(
// name
'wordcount',
// metadata
{
provides: ['words'],
requires: ['text'],
emits: [],
aggregates: false,
},
// body
function(serviceProvider, message) {
const wordsCount = message.text.split(/\W+/).length;
return {words: wordsCount};
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment