/
strip.js
58 lines (36 loc) · 1.73 KB
/
strip.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/***********************************************************************************
Abstractor | Strip module | MIT License | ©2016 Hexagon <github.com/hexagon>
Removed unwanted properties before apssing the message firther.
----------------------------------------------------------------------------
Options
One of these has to be set.
-----------------+-----------------+----------------------+-----------------
Option | Type | Default | Mandatory
-----------------+-----------------+----------------------+-----------------
member | string | undefined | one of these
members | array <string> | undefined | are mandatory
----------------------------------------------------------------------------
I/O
-------------------------------+----------------------+---------------------
Incoming property | Possible triggers | Output
-------------------------------+----------------------+---------------------
<any message> | success | <stripped message>
-------------------------------+----------------------+---------------------
***********************************************************************************/
"use strict";
const
Node = require("../node.js");
class Strip extends Node {
invoke(msg) {
if (this.config.member) {
msg[this.config.member] = undefined;
}
if (this.config.members) {
this.config.members.forEach(function(member) {
msg[member] = undefined;
});
}
this.trigger("success", msg);
}
}
module.exports = Strip;