@makano/rew 1.2.39 → 1.2.42
Sign up to get free protection for your applications and to get access to all the features.
package/lib/rew/const/default.js
CHANGED
@@ -11,6 +11,8 @@ const { print, input, clear } = require('../functions/stdout');
|
|
11
11
|
const { curl } = require('../functions/curl');
|
12
12
|
const { wait } = require('../functions/wait');
|
13
13
|
const { scheduleFrame } = require('../functions/misc');
|
14
|
+
const { jsons, yaml, json, yamls } = require('../functions/json');
|
15
|
+
const { generateRandomID } = require('../functions/id');
|
14
16
|
|
15
17
|
module.exports = {
|
16
18
|
cenum,
|
@@ -43,6 +45,13 @@ module.exports = {
|
|
43
45
|
compose,
|
44
46
|
curry,
|
45
47
|
|
48
|
+
json,
|
49
|
+
jsons,
|
50
|
+
yaml,
|
51
|
+
yamls,
|
52
|
+
|
53
|
+
genID: generateRandomID,
|
54
|
+
|
46
55
|
curl,
|
47
56
|
|
48
57
|
print,
|
package/lib/rew/functions/id.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
module.exports.generateRandomID = function generateRandomID(length = 12) {
|
2
|
-
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
1
|
+
module.exports.generateRandomID = function generateRandomID(length = 12, _characters) {
|
2
|
+
const characters = _characters || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
3
3
|
const charactersLength = characters.length;
|
4
4
|
let randomID = '';
|
5
5
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
const jsYaml = require("js-yaml");
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
function json(thing){
|
6
|
+
return JSON.parse(thing);
|
7
|
+
}
|
8
|
+
|
9
|
+
function jsons(thing){
|
10
|
+
return JSON.stringify(thing);
|
11
|
+
}
|
12
|
+
|
13
|
+
|
14
|
+
function yaml(thing){
|
15
|
+
return jsYaml.loadAll(thing)[0];
|
16
|
+
}
|
17
|
+
|
18
|
+
function yamls(thing){
|
19
|
+
return jsYaml.dump(thing);
|
20
|
+
}
|
21
|
+
|
22
|
+
module.exports = {
|
23
|
+
yaml,
|
24
|
+
yamls,
|
25
|
+
json,
|
26
|
+
jsons
|
27
|
+
}
|