-
Notifications
You must be signed in to change notification settings - Fork 0
/
objeq.js
64 lines (64 loc) · 1.41 KB
/
objeq.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
59
60
61
62
63
64
module.exports = {
name: "objeq",
ns: "array",
description: "objeq allows POJSO's (Plain-Old JavaScript Objects) to be queried in real-time.",
async: true,
phrases: {
active: "Querying object"
},
dependencies: {
npm: {
objeq: require('objeq')
}
},
ports: {
input: {
"in": {
title: "Array",
type: "array",
asyn: true,
fn: function __IN__(data, source, state, input, $, output, objeq) {
var r = function() {
try {
if ($.query !== state.q) {
state.q = $.query;
state.query = objeq(state.q);
}
var out = state.query($.in);
output({
out: $.write('in', out)
});
} catch (e) {
output({
error: $.write('in', e)
});
}
}.call(this);
return {
state: state,
return: r
};
}
},
query: {
title: "Query",
description: "See [Language Reference](https://github.com/agilosoftware/objeq/wiki/Language-Reference) to learn about the query syntax",
type: "string"
}
},
output: {
out: {
title: "Output",
type: "array"
},
error: {
title: "Error",
type: "Error"
}
}
},
state: {
query: null,
q: ""
}
}