forked from aretecode/canadianness
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
33 lines (27 loc) · 912 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const noflo = require('noflo');
const defaultSpellingData = require('./spellingdata.json');
const defaultWords = {
eh: 11,
'eh!': 11,
};
// Produce the JavaScript entry point
function canadianness(contentData, options, callback) {
// Normalize options
const spellingData = options.spelling || defaultSpellingData;
const wordsData = options.words || defaultWords;
// Convert options and input to a set of NoFlo packets to be sent
const inputs = {
words: wordsData,
spelling: spellingData,
content: contentData,
};
// Produce a NoFlo.asCallback wrapped function to execute our graph
const componentName = 'canadianness/Canadianness';
const wrapperFunction = noflo.asCallback(componentName, {
baseDir: __dirname,
});
// Run the graph with inputs and call callback
wrapperFunction(inputs, callback);
}
// Expose function as public API
module.exports = canadianness;