Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 24 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict' |
||
2 | |||
3 | module.exports = (input, callback) => { |
||
4 | const mqtt = require('mqtt') |
||
|
|||
5 | const validate = require('./validate') |
||
6 | let error = null |
||
7 | let output = null |
||
8 | |||
9 | validate(input, (validatedInput, thrownError) => { |
||
10 | input = validatedInput |
||
11 | error = thrownError |
||
12 | }) |
||
13 | |||
14 | output = { |
||
15 | 'version': {'ref': 'input'}, |
||
16 | 'metadata': [ |
||
17 | {'name': 'topic', 'value': 'Hulk Hogan'}, |
||
18 | {'name': 'timestamp', 'value': Date.now().toString()} |
||
19 | ] |
||
20 | } |
||
21 | |||
22 | |||
23 | callback(error, output, source) |
||
24 | } |
||
25 |