54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
}
catch (e) {
logerror(e);
return null
}
}
// conversions
function objectToMap (obj) {
let m = new Map();
for (let param in obj) {
//console.log(param + " " + obj[param]);
m.set(param, obj[param]);
}
return m;
}
function mapToObject (m) {
let obj = {};
for (let [k, v] of m) {
obj[k] = v;
}
return obj;
}
exports.echo = echo;
exports.logerror = logerror;
exports.objectToMap = objectToMap;
exports.mapToObject = mapToObject;
exports.setLogOutput = setLogOutput;
exports.loadFile = loadFile;
|
<
<
<
>
>
>
>
|
|
>
|
|
<
<
>
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
}
catch (e) {
logerror(e);
return null
}
}
// conversions
function objectToMap (obj) {
let m = new Map();
for (let param in obj) {
//console.log(param + " " + obj[param]);
m.set(param, obj[param]);
}
return m;
}
function mapToObject (m) {
let obj = {};
for (let [k, v] of m) {
obj[k] = v;
}
return obj;
}
if (typeof(exports) !== 'undefined') {
// Used for Grammalecte library.
// In content scripts, these variable are directly reachable
exports.setLogOutput = setLogOutput;
exports.echo = echo;
exports.logerror = logerror;
exports.loadFile = loadFile;
exports.objectToMap = objectToMap;
exports.mapToObject = mapToObject;
}
|