@ceeblue/web-utils 1.4.1 → 2.0.1

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.
@@ -114,10 +114,10 @@ declare class ByteRate {
114
114
  */
115
115
  type Params = {
116
116
  /**
117
- * Host to connect. Can include port, and accept also an url format with port and path,
118
- * it can help to force a path OR try to give a protocol preference
117
+ * endPoint to connect. Can be only a host(:port) but accept also a full url of connection,
118
+ * it can help to force a path or indicate a protocol preference
119
119
  */
120
- host: string;
120
+ endPoint: string;
121
121
  /**
122
122
  * The name of the stream to join
123
123
  */
package/dist/web-utils.js CHANGED
@@ -541,6 +541,13 @@ function stringify(obj, params = {}) {
541
541
  if (obj.toFixed) {
542
542
  return obj.toFixed(Number(params.decimal) || 0);
543
543
  }
544
+ if (obj.byteLength != null && (obj === null || obj === void 0 ? void 0 : obj[Symbol.iterator])) {
545
+ // Binary!
546
+ if (!params.noBin) {
547
+ return _decoder.decode(obj);
548
+ }
549
+ return '[' + obj.byteLength + '#bytes]';
550
+ }
544
551
  // boolean or string type or stop recursivity
545
552
  if (typeof obj === 'boolean' || obj.substring || !params.recursive) {
546
553
  // is already a string OR has to be stringified
@@ -556,14 +563,7 @@ function stringify(obj, params = {}) {
556
563
  }
557
564
  return (res += space + ']');
558
565
  }
559
- if (obj.byteLength != null && (obj === null || obj === void 0 ? void 0 : obj[Symbol.iterator])) {
560
- // Binary!
561
- return _decoder.decode(obj);
562
- }
563
566
  let res = '';
564
- if (params.noBin) {
565
- return '[' + obj.byteLength + '#bytes]';
566
- }
567
567
  for (const name in obj) {
568
568
  res += (res ? ',' : '{') + space + name + ':';
569
569
  res += stringify(obj[name], Object.assign(Object.assign({}, params), { recursive: params.recursive - 1 }));
@@ -706,7 +706,7 @@ class NetAddress {
706
706
  protocol = protocol.slice(0, -1); // Remove SSL
707
707
  }
708
708
  }
709
- // Build host!
709
+ // Build address!
710
710
  address = address.substring(found + 3);
711
711
  }
712
712
  return protocol + '://' + address;
@@ -811,7 +811,7 @@ var Type;
811
811
  * @returns The URL of connection
812
812
  */
813
813
  function buildURL(type, params, protocol = 'wss') {
814
- const url = new URL(NetAddress.fixProtocol(protocol, params.host));
814
+ const url = new URL(NetAddress.fixProtocol(protocol, params.endPoint));
815
815
  if (url.pathname.length <= 1) {
816
816
  // build ceeblue path!
817
817
  switch (type) {
@@ -1678,4 +1678,4 @@ class WebSocketReliable extends EventEmitter {
1678
1678
  * This file is part of https://github.com/CeeblueTV/web-utils which is released under GNU Affero General Public License.
1679
1679
  * See file LICENSE or go to https://spdx.org/licenses/AGPL-3.0-or-later.html for full license details.
1680
1680
  */
1681
- const VERSION = '1.4.1';export{BinaryReader,BinaryWriter,BitReader,ByteRate,Connect,EventEmitter,FixMap,NetAddress,Numbers,Queue,SDP,Util,VERSION,WebSocketReliable};//# sourceMappingURL=web-utils.js.map
1681
+ const VERSION = '2.0.1';export{BinaryReader,BinaryWriter,BitReader,ByteRate,Connect,EventEmitter,FixMap,NetAddress,Numbers,Queue,SDP,Util,VERSION,WebSocketReliable};//# sourceMappingURL=web-utils.js.map