@fuel-ts/math
Advanced tools
Comparing version 0.0.0-next-20220722175934 to 0.0.0-next-20220726172135
@@ -12,2 +12,5 @@ declare type BigNumberish = string | number | bigint; | ||
export { BigNumberish, toArray, toBigInt, toHex, toNumber }; | ||
declare function max(...numbers: Array<bigint>): bigint; | ||
declare function multiply(...numbers: Array<bigint | number>): bigint; | ||
export { BigNumberish, max, multiply, toArray, toBigInt, toHex, toNumber }; |
@@ -1,2 +0,2 @@ | ||
"use strict";(()=>{var f="0123456789abcdef";function u(n){if(n instanceof Uint8Array){let t="0x0";for(let r of n)t+=f[r>>4],t+=f[r&15];return BigInt(t)}return BigInt(n)}function s(n){let t=u(n);if(t<-9007199254740991||t>9007199254740991)throw new Error(`Value out of range: ${n}`);return Number(t)}function a(n,t){let r=BigInt(n);if(r<0)throw new Error("cannot convert negative value to hex");let e=r.toString(16);if(t==null)e.length%2&&(e=`0${e}`);else{if(t*2<e.length)throw new Error(`value ${r} exceeds width ${t}`);for(;e.length<t*2;)e=`0${e}`}return`0x${e}`}function l(n){let t=BigInt(n);if(t<0)throw new Error("cannot convert negative value to hex");if(t===0n)return new Uint8Array([]);let r=t.toString(16);r.length%2&&(r=`0${r}`);let e=new Uint8Array(r.length/2);for(let o=0;o<e.length;o+=1){let i=o*2;e[o]=parseInt(r.substring(i,i+2),16)}return e}})(); | ||
"use strict";(()=>{var u="0123456789abcdef";function a(t){if(t instanceof Uint8Array){let r="0x0";for(let e of t)r+=u[e>>4],r+=u[e&15];return BigInt(r)}return BigInt(t)}function f(t){let r=a(t);if(r<-9007199254740991||r>9007199254740991)throw new Error(`Value out of range: ${t}`);return Number(r)}function g(t,r){let e=BigInt(t);if(e<0)throw new Error("cannot convert negative value to hex");let n=e.toString(16);if(r==null)n.length%2&&(n=`0${n}`);else{if(r*2<n.length)throw new Error(`value ${e} exceeds width ${r}`);for(;n.length<r*2;)n=`0${n}`}return`0x${n}`}function l(t){let r=BigInt(t);if(r<0)throw new Error("cannot convert negative value to hex");if(r===0n)return new Uint8Array([]);let e=r.toString(16);e.length%2&&(e=`0${e}`);let n=new Uint8Array(e.length/2);for(let o=0;o<n.length;o+=1){let i=o*2;n[o]=parseInt(e.substring(i,i+2),16)}return n}function c(...t){return BigInt(Math.max(...t.map(r=>f(r))))}function x(...t){return BigInt(Math.ceil(t.reduce((r,e)=>Number(r)*Number(e),1)))}})(); | ||
//# sourceMappingURL=index.global.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var x=(r,t)=>{for(var e in t)o(r,e,{get:t[e],enumerable:!0})},h=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of l(t))!c.call(r,i)&&i!==e&&o(r,i,{get:()=>t[i],enumerable:!(n=a(t,i))||n.enumerable});return r};var m=r=>h(o({},"__esModule",{value:!0}),r);var y={};x(y,{toArray:()=>B,toBigInt:()=>g,toHex:()=>p,toNumber:()=>b});module.exports=m(y);var u="0123456789abcdef";function g(r){if(r instanceof Uint8Array){let t="0x0";for(let e of r)t+=u[e>>4],t+=u[e&15];return BigInt(t)}return BigInt(r)}function b(r){let t=g(r);if(t<-9007199254740991||t>9007199254740991)throw new Error(`Value out of range: ${r}`);return Number(t)}function p(r,t){let e=BigInt(r);if(e<0)throw new Error("cannot convert negative value to hex");let n=e.toString(16);if(t==null)n.length%2&&(n=`0${n}`);else{if(t*2<n.length)throw new Error(`value ${e} exceeds width ${t}`);for(;n.length<t*2;)n=`0${n}`}return`0x${n}`}function B(r){let t=BigInt(r);if(t<0)throw new Error("cannot convert negative value to hex");if(t===0n)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e=`0${e}`);let n=new Uint8Array(e.length/2);for(let i=0;i<n.length;i+=1){let f=i*2;n[i]=parseInt(e.substring(f,f+2),16)}return n}0&&(module.exports={toArray,toBigInt,toHex,toNumber}); | ||
"use strict";var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var x=(t,r)=>{for(var e in r)o(t,e,{get:r[e],enumerable:!0})},c=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of s(r))!b.call(t,i)&&i!==e&&o(t,i,{get:()=>r[i],enumerable:!(n=l(r,i))||n.enumerable});return t};var h=t=>c(o({},"__esModule",{value:!0}),t);var w={};x(w,{max:()=>B,multiply:()=>N,toArray:()=>y,toBigInt:()=>m,toHex:()=>p,toNumber:()=>f});module.exports=h(w);var g="0123456789abcdef";function m(t){if(t instanceof Uint8Array){let r="0x0";for(let e of t)r+=g[e>>4],r+=g[e&15];return BigInt(r)}return BigInt(t)}function f(t){let r=m(t);if(r<-9007199254740991||r>9007199254740991)throw new Error(`Value out of range: ${t}`);return Number(r)}function p(t,r){let e=BigInt(t);if(e<0)throw new Error("cannot convert negative value to hex");let n=e.toString(16);if(r==null)n.length%2&&(n=`0${n}`);else{if(r*2<n.length)throw new Error(`value ${e} exceeds width ${r}`);for(;n.length<r*2;)n=`0${n}`}return`0x${n}`}function y(t){let r=BigInt(t);if(r<0)throw new Error("cannot convert negative value to hex");if(r===0n)return new Uint8Array([]);let e=r.toString(16);e.length%2&&(e=`0${e}`);let n=new Uint8Array(e.length/2);for(let i=0;i<n.length;i+=1){let a=i*2;n[i]=parseInt(e.substring(a,a+2),16)}return n}function B(...t){return BigInt(Math.max(...t.map(r=>f(r))))}function N(...t){return BigInt(Math.ceil(t.reduce((r,e)=>Number(r)*Number(e),1)))}0&&(module.exports={max,multiply,toArray,toBigInt,toHex,toNumber}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@fuel-ts/math", | ||
"version": "0.0.0-next-20220722175934", | ||
"version": "0.0.0-next-20220726172135", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Fuel Labs <contact@fuel.sh> (https://fuel.network/)", |
export * from './convert'; | ||
export * from './types'; | ||
export * from './math'; |
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 not supported yet
Sorry, the diff of this file is not supported yet
29257
28