@zilliqa-js/util
Advanced tools
Comparing version 0.3.0 to 0.3.3
@@ -38,2 +38,13 @@ /** | ||
/** | ||
* pack | ||
* | ||
* Takes two 16-bit integers and combines them. Used to compute version. | ||
* | ||
* @param {number} a | ||
* @param {number} b | ||
* | ||
* @returns {number} - a 32-bit number | ||
*/ | ||
export declare const pack: (a: number, b: number) => number; | ||
/** | ||
* compareBytes | ||
@@ -40,0 +51,0 @@ * |
@@ -85,2 +85,18 @@ "use strict"; | ||
/** | ||
* pack | ||
* | ||
* Takes two 16-bit integers and combines them. Used to compute version. | ||
* | ||
* @param {number} a | ||
* @param {number} b | ||
* | ||
* @returns {number} - a 32-bit number | ||
*/ | ||
exports.pack = function (a, b) { | ||
if (a >> 16 > 0 || b >> 16 > 0) { | ||
throw new Error('Both a and b must be 16 bits or less'); | ||
} | ||
return (a << 16) + b; | ||
}; | ||
/** | ||
* compareBytes | ||
@@ -87,0 +103,0 @@ * |
{ | ||
"name": "@zilliqa-js/util", | ||
"version": "0.3.0", | ||
"version": "0.3.3", | ||
"description": "Utilities for working with Zillia.", | ||
@@ -26,3 +26,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "7099301a8c3cde45cf083f9f947ba6461001c927" | ||
"gitHead": "70062a8d95d22c313a6261d23d7a140cf3e43cd3" | ||
} |
@@ -71,2 +71,16 @@ # @zilliqa-js/util | ||
### `pack(a: number, b: number): number` | ||
Performs bitwise addition of two 16-bit numbers, returning a 32-bit number. | ||
Throws if either number exceeds 16 bits. | ||
**Parameters** | ||
- `a`: `number` - a 16-bit number. | ||
- `b`: `number` - a 16-bit number. | ||
**Returns** | ||
- `number` - the combined 32-bit number. | ||
### `compareBytes(a: string, b: string): boolean` | ||
@@ -73,0 +87,0 @@ |
@@ -101,2 +101,20 @@ /** | ||
/** | ||
* pack | ||
* | ||
* Takes two 16-bit integers and combines them. Used to compute version. | ||
* | ||
* @param {number} a | ||
* @param {number} b | ||
* | ||
* @returns {number} - a 32-bit number | ||
*/ | ||
export const pack = (a: number, b: number): number => { | ||
if (a >> 16 > 0 || b >> 16 > 0) { | ||
throw new Error('Both a and b must be 16 bits or less'); | ||
} | ||
return (a << 16) + b; | ||
}; | ||
/** | ||
* compareBytes | ||
@@ -103,0 +121,0 @@ * |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1416115
9819
241