@leofcoin/peernet 0.11.5 → 0.11.6

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.
@@ -102,6 +102,28 @@ class FormatInterface {
102
102
  else this.decode();
103
103
  }
104
104
 
105
+ toString() {
106
+ return this.encoded.toString()
107
+ }
108
+
109
+ async toArray() {
110
+ const array = [];
111
+ for await (const value of this.encoded.values()) {
112
+ array.push(value);
113
+ }
114
+ return array
115
+ }
116
+
117
+ fromString(string) {
118
+ this.encoded = new Uint8Array(string.split(','));
119
+ this.decode();
120
+ }
121
+
122
+ fromArray(array) {
123
+ this.encoded = new Uint8Array([...array]);
124
+ this.decode();
125
+ }
126
+
105
127
  /**
106
128
  * @param {Buffer} encoded
107
129
  */
@@ -10,7 +10,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
  var PubSub__default = /*#__PURE__*/_interopDefaultLegacy(PubSub);
11
11
  var Koa__default = /*#__PURE__*/_interopDefaultLegacy(Koa);
12
12
 
13
- var version = "0.11.4";
13
+ var version = "0.11.5";
14
14
 
15
15
  var api$1 = {
16
16
  version: ({send}) => send({client: '@peernet/api/http', version}),
@@ -1636,7 +1636,7 @@ class Peernet {
1636
1636
  protocol: 'peernet-v0.1.0', host: '127.0.0.1', port: options.port
1637
1637
  });
1638
1638
  } else {
1639
- const http = await Promise.resolve().then(function () { return require('./http-ee1b2071.js'); });
1639
+ const http = await Promise.resolve().then(function () { return require('./http-1600124a.js'); });
1640
1640
  if (environment !== 'browser') http.default(options);
1641
1641
  }
1642
1642
 
@@ -1062,6 +1062,28 @@ class FormatInterface {
1062
1062
  else this.decode();
1063
1063
  }
1064
1064
 
1065
+ toString() {
1066
+ return this.encoded.toString()
1067
+ }
1068
+
1069
+ async toArray() {
1070
+ const array = [];
1071
+ for await (const value of this.encoded.values()) {
1072
+ array.push(value);
1073
+ }
1074
+ return array
1075
+ }
1076
+
1077
+ fromString(string) {
1078
+ this.encoded = new Uint8Array(string.split(','));
1079
+ this.decode();
1080
+ }
1081
+
1082
+ fromArray(array) {
1083
+ this.encoded = new Uint8Array([...array]);
1084
+ this.decode();
1085
+ }
1086
+
1065
1087
  /**
1066
1088
  * @param {Buffer} encoded
1067
1089
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "0.11.5",
3
+ "version": "0.11.6",
4
4
  "description": "",
5
5
  "main": "dist/commonjs/peernet.js",
6
6
  "module": "dist/module/peernet.js",
@@ -92,6 +92,28 @@ export default class FormatInterface {
92
92
  else this.decode()
93
93
  }
94
94
 
95
+ toString() {
96
+ return this.encoded.toString()
97
+ }
98
+
99
+ async toArray() {
100
+ const array = []
101
+ for await (const value of this.encoded.values()) {
102
+ array.push(value)
103
+ }
104
+ return array
105
+ }
106
+
107
+ fromString(string) {
108
+ this.encoded = new Uint8Array(string.split(','))
109
+ this.decode()
110
+ }
111
+
112
+ fromArray(array) {
113
+ this.encoded = new Uint8Array([...array])
114
+ this.decode()
115
+ }
116
+
95
117
  /**
96
118
  * @param {Buffer} encoded
97
119
  */