@leofcoin/codec-format-interface 1.4.3 → 1.5.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/dist/index.js +5405 -235
- package/package.json +8 -4
- package/rollup.config.js +7 -11
- package/src/basic-interface.js +6 -6
- package/src/{index.js → index.ts} +0 -0
- package/test/index.js +2 -2
- package/tsconfig.js +16 -0
- package/dist/module.js +0 -4841
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/codec-format-interface",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "rollup -c"
|
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
"varint": "^6.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"rollup": "^
|
|
31
|
-
"
|
|
30
|
+
"@rollup/plugin-commonjs": "^23.0.3",
|
|
31
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
32
|
+
"@rollup/plugin-typescript": "^10.0.1",
|
|
33
|
+
"rollup": "^3.5.1",
|
|
34
|
+
"tape": "^5.5.3",
|
|
35
|
+
"tslib": "^2.4.1"
|
|
32
36
|
}
|
|
33
37
|
}
|
package/rollup.config.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import resolve from 'rollup
|
|
2
|
-
import commonjs from 'rollup
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve'
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs'
|
|
3
|
+
import typescript from '@rollup/plugin-typescript'
|
|
3
4
|
export default [{
|
|
4
|
-
input: ['src/index.
|
|
5
|
+
input: ['src/index.ts'],
|
|
5
6
|
output: [{
|
|
6
|
-
|
|
7
|
-
format: 'cjs'
|
|
8
|
-
}]
|
|
9
|
-
}, {
|
|
10
|
-
input: ['src/index.js'],
|
|
11
|
-
output: [{
|
|
12
|
-
file: 'dist/module.js',
|
|
7
|
+
file: 'dist/index.js',
|
|
13
8
|
format: 'es'
|
|
14
9
|
}],
|
|
15
10
|
plugins: [
|
|
16
11
|
commonjs(),
|
|
17
|
-
resolve()
|
|
12
|
+
resolve({preferBuiltins: true}),
|
|
13
|
+
typescript()
|
|
18
14
|
]
|
|
19
15
|
}]
|
package/src/basic-interface.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import bs32 from '@vandeurenglenn/base32';
|
|
2
|
-
import
|
|
2
|
+
import base58 from '@vandeurenglenn/base58';
|
|
3
3
|
import isHex from '@vandeurenglenn/is-hex';
|
|
4
4
|
|
|
5
5
|
export default class BasicInterface {
|
|
@@ -19,7 +19,7 @@ export default class BasicInterface {
|
|
|
19
19
|
return bs32.isBase32(string)
|
|
20
20
|
}
|
|
21
21
|
isBase58(string) {
|
|
22
|
-
return
|
|
22
|
+
return base58.isBase58(string)
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* @param {String} encoded
|
|
@@ -32,8 +32,8 @@ export default class BasicInterface {
|
|
|
32
32
|
/**
|
|
33
33
|
* @param {String} encoded
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
this.encoded =
|
|
35
|
+
frombase58(encoded) {
|
|
36
|
+
this.encoded = base58.decode(encoded)
|
|
37
37
|
return this.handleDecode()
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -94,9 +94,9 @@ export default class BasicInterface {
|
|
|
94
94
|
/**
|
|
95
95
|
* @return {String} encoded
|
|
96
96
|
*/
|
|
97
|
-
async
|
|
97
|
+
async tobase58() {
|
|
98
98
|
if (!this.encoded) await this.handleEncode()
|
|
99
|
-
return
|
|
99
|
+
return base58.encode(this.encoded)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
File without changes
|
package/test/index.js
CHANGED
package/tsconfig.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
'allowSyntheticDefaultImports': true,
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
'allowSyntheticDefaultImports': true,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"target": "es11"
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"./src/**/*",
|
|
14
|
+
"./node_modules/**/*"
|
|
15
|
+
]
|
|
16
|
+
}
|