Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@burstjs/util

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@burstjs/util - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

.rpt2_cache/rpt2_1563092afed445937cecd716daf23df56df0bfcb/code/cache/2c37cec7283e27c5d3fcb6f877ba60281f84da2f

7

dist/burstjs.util.js

@@ -351,9 +351,2 @@ var b$util = (function (exports) {

var burstAddressPattern = {
'_': {
pattern: new RegExp('\[a-zA-Z0-9\]')
}
};
exports.burstAddressPattern = burstAddressPattern;
exports.convertAddressToNumericId = convertAddressToNumericId;

@@ -360,0 +353,0 @@ exports.convertBurstTimeToDate = convertBurstTimeToDate;

2

dist/burstjs.util.min.js

@@ -1,2 +0,2 @@

var b$util=function(r){"use strict";var n=function(r){if(null==r||""===r)throw new Error("Invalid argument");return parseFloat(r)/1e8},t=Date.UTC(2014,7,11,2,0,0,0)/1e3,e=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],i=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],u=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],a="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),f=function(r,n){return 0===r||0===n?0:o[(i[r]+i[n])%31]},c=function(r){return 1e3*(t+r)},v=function(r){0===r.indexOf("BURST-")&&(r=r.substr(6));for(var n=e.slice(),t=0,i=0;i<r.length;i++){var c=a.indexOf(r.charAt(i));if(!(c<=-1||c>a.length)){if(t>16)return!1;n[u[t]]=c,t++}}if(17!==t)return!1;for(var v=0,l=1;l<5;l++){for(var s=0,g=0;g<31;g++)if(!(g>12&&g<27)){var h=g;g>26&&(h-=14),s^=f(n[h],o[l*g%31])}v|=s}return 0===v};var l=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(0===t)return"";var e=r;if(0!==n){var o=null===t?r.length-n:t;!function(r,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t<0)throw new Error("Start index should not be negative");if(r.length<t+n)throw new Error("Need at least "+n+" bytes to convert to an integer")}(e,o,n),e=r.slice(n,n+o)}return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))};var s=function(r){for(var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=[],e=0;e<r.length;e++)t.push((r[e]>>>4).toString(16)),t.push((15&r[e]).toString(16));return n?t.join("").toUpperCase():t.join("")},g=function(r){for(var n=[],t=0;t<r.length;t+=2){var e=parseInt(r.substr(t,2),16);if(Number.isNaN(e))throw new Error("Invalid Hex String: ".concat(r));n.push(e)}return n},h=function(r){for(var n=unescape(encodeURIComponent(r)),t=new Array(n.length),e=0;e<n.length;++e)t[e]=n.charCodeAt(e);return t},d={_:{pattern:new RegExp("[a-zA-Z0-9]")}};return r.burstAddressPattern=d,r.convertAddressToNumericId=function(r){if(null!=r&&0!==r.trim().length&&0===r.indexOf("BURST-")){r=r.substr(6);for(var n=e.slice(),t=0,o=0;o<r.length;o++){var i=a.indexOf(r.charAt(o));if(!(i<=-1||i>a.length)){if(t>16)return;n[u[t]]=i,t++}}if(v(r)){for(var f=13,c=[],l=0;l<f;l++)c[l]=n[f-l-1];var s,g="",h=0;do{s=0,h=0;for(var d=0;d<f;d++)(h=32*h+c[d])>=10?(c[s]=Math.floor(h/10),h%=10,s+=1):s>0&&(c[s]=0,s+=1);f=s,g+=h}while(f>0);return g.split("").reverse().join("")}}},r.convertBurstTimeToDate=function(r){return new Date(c(r))},r.convertBurstTimeToEpochTime=c,r.convertByteArrayToHexString=s,r.convertByteArrayToString=l,r.convertDateToBurstTime=function(r){return Math.round(r.getTime()/1e3)-t},r.convertHexStringToByteArray=g,r.convertHexStringToDecString=function(r){var n,t,e,o=[0];for(n=0;n<r.length;n+=1){for(e=parseInt(r.charAt(n),16),t=0;t<o.length;t+=1)o[t]=16*o[t]+e,e=o[t]/10|0,o[t]%=10;for(;e>0;)o.push(e%10),e=e/10|0}return o.reverse().join("")},r.convertHexStringToString=function(r){return l(g(r))},r.convertNQTStringToNumber=n,r.convertNumberToNQTString=function(r){if(null==r)throw new Error("Invalid argument");return parseFloat(r.toString()).toFixed(8).replace(".","")},r.convertNumericIdToAddress=function(r){if(null!=r&&0!==r.trim().length){for(var n=[],t=e.slice(),o=0,i=r.length,c=0;c<i;c++)n[c]=r.charCodeAt(c)-"0".charCodeAt(0);var v=0,l=0;do{v=0,l=0;for(var s=0;s<i;s++)(v=10*v+n[s])>=32?(n[l]=v>>5,v&=31,l++):l>0&&(n[l]=0,l++);i=l,t[o]=v,o++}while(i>0);for(var g=[0,0,0,0],h=12;h>=0;h--){var d=t[h]^g[3];g[3]=g[2]^f(30,d),g[2]=g[1]^f(6,d),g[1]=g[0]^f(9,d),g[0]=f(17,d)}t[13]=g[0],t[14]=g[1],t[15]=g[2],t[16]=g[3];for(var T="BURST-",S=0;S<17;S++)T+=a[t[u[S]]],3==(3&S)&&S<13&&(T+="-");return T}},r.convertStringToByteArray=h,r.convertStringToHexString=function(r){return s(h(r))},r.isBurstAddress=function(r){return/^BURST\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{5}/i.test(r)&&v(r)},r.isValid=v,r.sumNQTStringToNumber=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return t.reduce(function(r,t){return r+n(t)},0)},r}({});
var b$util=function(r){"use strict";var n=function(r){if(null==r||""===r)throw new Error("Invalid argument");return parseFloat(r)/1e8},t=Date.UTC(2014,7,11,2,0,0,0)/1e3,e=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],i=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],u=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],a="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),f=function(r,n){return 0===r||0===n?0:o[(i[r]+i[n])%31]},c=function(r){return 1e3*(t+r)},v=function(r){0===r.indexOf("BURST-")&&(r=r.substr(6));for(var n=e.slice(),t=0,i=0;i<r.length;i++){var c=a.indexOf(r.charAt(i));if(!(c<=-1||c>a.length)){if(t>16)return!1;n[u[t]]=c,t++}}if(17!==t)return!1;for(var v=0,l=1;l<5;l++){for(var s=0,g=0;g<31;g++)if(!(g>12&&g<27)){var h=g;g>26&&(h-=14),s^=f(n[h],o[l*g%31])}v|=s}return 0===v};var l=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(0===t)return"";var e=r;if(0!==n){var o=null===t?r.length-n:t;!function(r,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t<0)throw new Error("Start index should not be negative");if(r.length<t+n)throw new Error("Need at least "+n+" bytes to convert to an integer")}(e,o,n),e=r.slice(n,n+o)}return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))};var s=function(r){for(var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=[],e=0;e<r.length;e++)t.push((r[e]>>>4).toString(16)),t.push((15&r[e]).toString(16));return n?t.join("").toUpperCase():t.join("")},g=function(r){for(var n=[],t=0;t<r.length;t+=2){var e=parseInt(r.substr(t,2),16);if(Number.isNaN(e))throw new Error("Invalid Hex String: ".concat(r));n.push(e)}return n},h=function(r){for(var n=unescape(encodeURIComponent(r)),t=new Array(n.length),e=0;e<n.length;++e)t[e]=n.charCodeAt(e);return t};return r.convertAddressToNumericId=function(r){if(null!=r&&0!==r.trim().length&&0===r.indexOf("BURST-")){r=r.substr(6);for(var n=e.slice(),t=0,o=0;o<r.length;o++){var i=a.indexOf(r.charAt(o));if(!(i<=-1||i>a.length)){if(t>16)return;n[u[t]]=i,t++}}if(v(r)){for(var f=13,c=[],l=0;l<f;l++)c[l]=n[f-l-1];var s,g="",h=0;do{s=0,h=0;for(var d=0;d<f;d++)(h=32*h+c[d])>=10?(c[s]=Math.floor(h/10),h%=10,s+=1):s>0&&(c[s]=0,s+=1);f=s,g+=h}while(f>0);return g.split("").reverse().join("")}}},r.convertBurstTimeToDate=function(r){return new Date(c(r))},r.convertBurstTimeToEpochTime=c,r.convertByteArrayToHexString=s,r.convertByteArrayToString=l,r.convertDateToBurstTime=function(r){return Math.round(r.getTime()/1e3)-t},r.convertHexStringToByteArray=g,r.convertHexStringToDecString=function(r){var n,t,e,o=[0];for(n=0;n<r.length;n+=1){for(e=parseInt(r.charAt(n),16),t=0;t<o.length;t+=1)o[t]=16*o[t]+e,e=o[t]/10|0,o[t]%=10;for(;e>0;)o.push(e%10),e=e/10|0}return o.reverse().join("")},r.convertHexStringToString=function(r){return l(g(r))},r.convertNQTStringToNumber=n,r.convertNumberToNQTString=function(r){if(null==r)throw new Error("Invalid argument");return parseFloat(r.toString()).toFixed(8).replace(".","")},r.convertNumericIdToAddress=function(r){if(null!=r&&0!==r.trim().length){for(var n=[],t=e.slice(),o=0,i=r.length,c=0;c<i;c++)n[c]=r.charCodeAt(c)-"0".charCodeAt(0);var v=0,l=0;do{v=0,l=0;for(var s=0;s<i;s++)(v=10*v+n[s])>=32?(n[l]=v>>5,v&=31,l++):l>0&&(n[l]=0,l++);i=l,t[o]=v,o++}while(i>0);for(var g=[0,0,0,0],h=12;h>=0;h--){var d=t[h]^g[3];g[3]=g[2]^f(30,d),g[2]=g[1]^f(6,d),g[1]=g[0]^f(9,d),g[0]=f(17,d)}t[13]=g[0],t[14]=g[1],t[15]=g[2],t[16]=g[3];for(var T="BURST-",S=0;S<17;S++)T+=a[t[u[S]]],3==(3&S)&&S<13&&(T+="-");return T}},r.convertStringToByteArray=h,r.convertStringToHexString=function(r){return s(h(r))},r.isBurstAddress=function(r){return/^BURST\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{5}/i.test(r)&&v(r)},r.isValid=v,r.sumNQTStringToNumber=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return t.reduce(function(r,t){return r+n(t)},0)},r}({});
//# sourceMappingURL=burstjs.util.min.js.map

@@ -17,6 +17,1 @@ export * from './convertNumberToNQTString';

export * from './convertStringToHexString';
export declare const burstAddressPattern: {
'_': {
pattern: RegExp;
};
};
{
"name": "@burstjs/util",
"version": "0.4.0",
"version": "0.4.1",
"description": "Useful utilities and tools for building Burstcoin applications",

@@ -59,3 +59,3 @@ "keywords": [

},
"gitHead": "c07c6b48f0fea00198433fab5394628c2bfade4d"
"gitHead": "3df2ccc9605cedcb2bfdc7868f401bd6a536970f"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc