Socket
Socket
Sign inDemoInstall

qcloud-iotexplorer-common-libs

Package Overview
Dependencies
5
Maintainers
3
Versions
87
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-alpha.7 to 3.0.0-alpha.8

78

dist/esm/utils/byte-util.js

@@ -40,3 +40,3 @@ /* eslint-disable */

export function putString2bytes(destbytes, srcString, destOffset, srcOffset, count) {
const stringBytes = this.stringToByteArray(srcString);
const stringBytes = stringToByteArray(srcString);
for (let i = 0; i < count; i++) {

@@ -69,3 +69,3 @@ destbytes[count + i] = stringBytes[i];

for (let i = 0; i < len; i++) {
bytes[i] = this.convertUint8toByte(uint8s[i]);
bytes[i] = convertUint8toByte(uint8s[i]);
}

@@ -106,3 +106,3 @@ return bytes;

for (let i = 0; i < len; i++) {
uint8s[i] = this.convertByte2Uint8(bytes[i]);
uint8s[i] = convertByte2Uint8(bytes[i]);
}

@@ -122,3 +122,3 @@ return uint8s;

for (let i = 0; i < count; i++) {
destUint8s[destOffset + i] = this.convertByte2Uint8(srcBytes[srcOffset
destUint8s[destOffset + i] = convertByte2Uint8(srcBytes[srcOffset
+ i]);

@@ -160,3 +160,3 @@ }

.forEach((numByte) => {
retArr.push(this.byteToHex(numByte & 0xff));
retArr.push(byteToHex(numByte & 0xff));
});

@@ -172,4 +172,4 @@ return retArr.join(optSeparator || '');

export function convertByte2HexString(b) {
const u8 = this.convertByte2Uint8(b);
return this.byteToHex(u8);
const u8 = convertByte2Uint8(b);
return byteToHex(u8);
}

@@ -183,3 +183,3 @@ /**

export function convertU8ToHexString(u8) {
return this.byteToHex(u8);
return byteToHex(u8);
}

@@ -198,3 +198,3 @@ /**

}
const hexString = this.convertByte2HexString(uint8);
const hexString = convertByte2HexString(uint8);
let low;

@@ -236,4 +236,4 @@ let high;

export function combine2bytesToU16(high, low) {
const highU8 = this.convertByte2Uint8(high);
const lowU8 = this.convertByte2Uint8(low);
const highU8 = convertByte2Uint8(high);
const lowU8 = convertByte2Uint8(low);
// eslint-disable-next-line no-mixed-operators

@@ -245,3 +245,3 @@ return highU8 << 8 | lowU8;

for (let i = 0; i < len; i++) {
data[i] = this.convertUint8toByte('1');
data[i] = convertUint8toByte('1');
}

@@ -257,8 +257,8 @@ return data;

export function genSpecBytes(len) {
const u8 = this.convertByte2Uint8(len);
return this.getSpecBytesFromChar(u8);
const u8 = convertByte2Uint8(len);
return getSpecBytesFromChar(u8);
}
export function parseBssid(bssidBytes) {
const bytes = new Int8Array([...bssidBytes]);
return this.getParsedBssid(bytes);
return getParsedBssid(bytes);
}

@@ -279,3 +279,3 @@ /**

k = 0xff & bssidByte;
hexK = this.byteToHex(k);
hexK = byteToHex(k);
sb += hexK;

@@ -321,3 +321,3 @@ }

// TODO(user): Use native implementations if/when available
const out = new Int8Array(this.getStringBytesLength(str));
const out = new Int8Array(getStringBytesLength(str));
let p = 0;

@@ -390,3 +390,3 @@ for (let i = 0; i < str.length; i++) {

case 'UTF-8':
return this.stringToUtf8ByteArray(string);
return stringToUtf8ByteArray(string);
}

@@ -407,3 +407,3 @@ }

for (let i = 0; i < len; i += 2) {
data[((i / 2 | 0))] = this.convertNumberToByte(((parseInt(s.charAt(i), 16) << 4) + parseInt(s.charAt(i + 1), 16)) | 0);
data[((i / 2 | 0))] = convertNumberToByte(((parseInt(s.charAt(i), 16) << 4) + parseInt(s.charAt(i + 1), 16)) | 0);
}

@@ -421,3 +421,4 @@ return data;

const view = new DataView(buf.buffer);
return fixedLength === undefined ? view.getFloat32(0) : view.getFloat32(0).toFixed(fixedLength);
return fixedLength === undefined ? view.getFloat32(0) : view.getFloat32(0)
.toFixed(fixedLength);
}

@@ -427,8 +428,9 @@ export function float32ToHexArray(float) {

const dataView = new DataView(buf.buffer);
const hex = dataView.getUint32(0).toString(16);
return this.hexString2hexArray(`${'0000000000'.slice(0, 8 - hex.length)}${hex}`);
const hex = dataView.getUint32(0)
.toString(16);
return hexString2hexArray(`${'0000000000'.slice(0, 8 - hex.length)}${hex}`);
}
export function hex2Int32(s) {
if (typeof s === 'string') {
s = this.hexString2hexArray(s);
s = hexString2hexArray(s);
}

@@ -472,3 +474,3 @@ if (s.length !== 4) {

}
return this.convertNumberToByte((crc & 0xff));
return convertNumberToByte((crc & 0xff));
}

@@ -478,3 +480,3 @@ export function crc8Bytes(bs, len) {

for (let i = 0; i < len; ++i) {
crc = this.crc8Byte((crc ^ bs[i]));
crc = crc8Byte((crc ^ bs[i]));
}

@@ -509,3 +511,3 @@ return crc;

// 20 = 0x14
const result = this.splitUint8To2bytes(20);
const result = splitUint8To2bytes(20);
if (result[0] === 1 && result[1] === 4) {

@@ -521,3 +523,3 @@ console.log('test_splitUint8To2bytes(): pass');

const low = 0x04;
if (this.combine2bytesToOne(high, low) === 20) {
if (combine2bytesToOne(high, low) === 20) {
console.log('test_combine2bytesToOne(): pass');

@@ -535,4 +537,4 @@ }

const b3 = -1;
if (this.convertByte2Uint8(b1) === 97 && this.convertByte2Uint8(b2) === 128
&& this.convertByte2Uint8(b3) === 255) {
if (convertByte2Uint8(b1) === 97 && convertByte2Uint8(b2) === 128
&& convertByte2Uint8(b3) === 255) {
console.log('test_convertChar2Uint8(): pass');

@@ -550,4 +552,4 @@ }

const c3 = 255;
if (this.convertUint8toByte(c1) === 97 && this.convertUint8toByte(c2) === -128
&& this.convertUint8toByte(c3) === -1) {
if (convertUint8toByte(c1) === 97 && convertUint8toByte(c2) === -128
&& convertUint8toByte(c3) === -1) {
console.log('test_convertUint8toByte(): pass');

@@ -561,4 +563,4 @@ }

const b = [15, -2, 52, -102, -93, -60];
console.log(this.parseBssid(b));
if (this.parseBssid(b) === '0ffe349aa3c4') {
console.log(parseBssid(b));
if (parseBssid(b) === '0ffe349aa3c4') {
console.log('test_parseBssid(): pass');

@@ -571,8 +573,8 @@ }

// testMain() {
// this.testConvertUint8toByte();
// this.testConvertChar2Uint8();
// this.testSplitUint8To2bytes();
// this.testCombine2bytesToOne();
// this.testParseBssid();
// testConvertUint8toByte();
// testConvertChar2Uint8();
// testSplitUint8To2bytes();
// testCombine2bytesToOne();
// testParseBssid();
// }
//# sourceMappingURL=byte-util.js.map

@@ -71,3 +71,3 @@ export declare function toInt8Array(bytes: any): any;

*/
export declare function convertByte2HexString(b: any): any;
export declare function convertByte2HexString(b: any): string;
/**

@@ -79,3 +79,3 @@ * Convert char(uint8) to Hex String

*/
export declare function convertU8ToHexString(u8: any): any;
export declare function convertU8ToHexString(u8: any): string;
/**

@@ -113,4 +113,4 @@ * Split uint8 to 2 bytes of high byte and low byte. e.g. 20 = 0x14 should

*/
export declare function genSpecBytes(len: any): any;
export declare function parseBssid(bssidBytes: any): any;
export declare function genSpecBytes(len: any): Int8Array;
export declare function parseBssid(bssidBytes: any): string;
/**

@@ -138,11 +138,11 @@ * parse "24,-2,52,-102,-93,-60" to "18,fe,34,9a,a3,c4"

*/
export declare function getBytesByString(string: any): any;
export declare function getBytesByString(string: any): Int8Array;
export declare function hexStringToByteArray(s: any): any[];
export declare function hexString2hexArray(hexString?: string): RegExpMatchArray;
export declare function hexArray2Float32(hexArray: any, fixedLength: any): string | number;
export declare function float32ToHexArray(float: any): any;
export declare function float32ToHexArray(float: any): RegExpMatchArray;
export declare function hex2Int32(s: any): number;
export declare function int32ToHex(int32: any): string;
export declare function arrayCopy(srcPts: any, srcOff: any, dstPts: any, dstOff: any, size: any): void;
export declare function crc8Byte(c: any): any;
export declare function crc8Byte(c: any): number;
export declare function crc8Bytes(bs: any, len: any): number;

@@ -149,0 +149,0 @@ export declare function base64Encode(string: any): string;

{
"name": "qcloud-iotexplorer-common-libs",
"version": "3.0.0-alpha.7",
"version": "3.0.0-alpha.8",
"description": "腾讯云IOT前端通用工具库",

@@ -21,3 +21,3 @@ "bugs": {

"dependencies": {
"qcloud-iotexplorer-logger": "3.0.0-alpha.7",
"qcloud-iotexplorer-logger": "3.0.0-alpha.8",
"rxjs": "^7.8.0",

@@ -31,3 +31,3 @@ "shortid-for-miniprogram": "^2.2.15",

},
"gitHead": "2beee0b6e6dcf5f91d52e77b54f80d8312110cbd"
"gitHead": "674e0cca069a33a99965f5bd2bc5ceaab04a3648"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc