-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjq.js
More file actions
38 lines (36 loc) · 1.18 KB
/
jq.js
File metadata and controls
38 lines (36 loc) · 1.18 KB
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
loadScript("jq-emscripten.js");
(function() {
var ProcessWithJQ;
ProcessWithJQ = function() {
var jqOutput = '';
this.evaluate = function() {
jq(['-M', this.jqargs, '/data/inputfile'], this.jsonInput, function(jqResult) {
jqOutput = jqResult
});
if (jqOutput.match(/^jq: error:/)) {
console.error(jqOutput);
return null;
} else {
return jqOutput;
}
};
this.title = function() {
return "jq JSON processor";
};
this.text = function() {
return null;
};
};
ProcessWithJQ.identifier = "com.virtzilla.PawExtensions.jq";
ProcessWithJQ.title = "jq JSON processor";
ProcessWithJQ.help = "https://stedolan.github.io/jq/manual/#Basicfilters"
ProcessWithJQ.inputs = [
DynamicValueInput("jqargs", "JQ args", "String", {
defaultValue: "."
}),
DynamicValueInput("jsonInput", "JSON input", "String", {
placeholder: "{\"change me\": \"put your JSON input here\"}"
})
];
registerDynamicValueClass(ProcessWithJQ);
}).call(this);