@onflow/rlp
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -5,4 +5,8 @@ ### Unreleased | ||
### 0.0.1 -- 2020-10-28 | ||
- 2020-10-13 -- fix export issue on get length | ||
### 0.0.0 -- 2020-10-07 | ||
- 2020-09-29 -- Initial port from etheriumjs/rlp. |
@@ -1,2 +0,2 @@ | ||
function r(r,e){if(r<56)return Buffer.from([r+e]);var f=n(r),t=n(e+55+f.length/2);return Buffer.from(t+f,"hex")}function e(r){return"0x"===r.slice(0,2)}function n(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function f(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return e(r)?Buffer.from((t="string"!=typeof(u=r)?u:e(u)?u.slice(2):u).length%2?"0"+t:t,"hex"):Buffer.from(r);if("number"==typeof r)return r?(f=n(r),Buffer.from(f,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var f,t,u;return r}exports.getLength=function(r){if(!r||0===r.length)return Buffer.from([]);var e=f(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var t=n-246;return t+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,t).toString("hex"))},exports.encode=function e(n){if(Array.isArray(n)){for(var t=[],u=0;u<n.length;u++)t.push(e(n[u]));var i=Buffer.concat(t);return Buffer.concat([r(i.length,192),i])}var o=f(n);return 1===o.length&&o[0]<128?o:Buffer.concat([r(o.length,128),o])},exports.toBuffer=f; | ||
function r(r,e){if(r<56)return Buffer.from([r+e]);var f=n(r),t=n(e+55+f.length/2);return Buffer.from(t+f,"hex")}function e(r){return"0x"===r.slice(0,2)}function n(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function f(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return e(r)?Buffer.from((t="string"!=typeof(u=r)?u:e(u)?u.slice(2):u).length%2?"0"+t:t,"hex"):Buffer.from(r);if("number"==typeof r)return r?(f=n(r),Buffer.from(f,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var f,t,u;return r}exports.encode=function e(n){if(Array.isArray(n)){for(var t=[],u=0;u<n.length;u++)t.push(e(n[u]));var i=Buffer.concat(t);return Buffer.concat([r(i.length,192),i])}var o=f(n);return 1===o.length&&o[0]<128?o:Buffer.concat([r(o.length,128),o])},exports.getLength=function(r){if(!r||0===r.length)return Buffer.from([]);var e=f(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var t=n-246;return t+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,t).toString("hex"))},exports.toBuffer=f; | ||
//# sourceMappingURL=rlp.js.map |
@@ -1,2 +0,2 @@ | ||
function r(n){if(Array.isArray(n)){for(var f=[],u=0;u<n.length;u++)f.push(r(n[u]));var i=Buffer.concat(f);return Buffer.concat([e(i.length,192),i])}var o=t(n);return 1===o.length&&o[0]<128?o:Buffer.concat([e(o.length,128),o])}function e(r,e){if(r<56)return Buffer.from([r+e]);var n=f(r),t=f(e+55+n.length/2);return Buffer.from(t+n,"hex")}function n(r){return"0x"===r.slice(0,2)}function f(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function t(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return n(r)?Buffer.from((t="string"!=typeof(u=r)?u:n(u)?u.slice(2):u).length%2?"0"+t:t,"hex"):Buffer.from(r);if("number"==typeof r)return r?(e=f(r),Buffer.from(e,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var e,t,u;return r}exports.getLength=function(r){if(!r||0===r.length)return Buffer.from([]);var e=t(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var f=n-246;return f+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,f).toString("hex"))};export{r as encode,t as toBuffer}; | ||
function r(n){if(Array.isArray(n)){for(var f=[],t=0;t<n.length;t++)f.push(r(n[t]));var i=Buffer.concat(f);return Buffer.concat([e(i.length,192),i])}var o=u(n);return 1===o.length&&o[0]<128?o:Buffer.concat([e(o.length,128),o])}function e(r,e){if(r<56)return Buffer.from([r+e]);var n=t(r),f=t(e+55+n.length/2);return Buffer.from(f+n,"hex")}function n(r){if(!r||0===r.length)return Buffer.from([]);var e=u(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var f=n-246;return f+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,f).toString("hex"))}function f(r){return"0x"===r.slice(0,2)}function t(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function u(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return f(r)?Buffer.from((n="string"!=typeof(u=r)?u:f(u)?u.slice(2):u).length%2?"0"+n:n,"hex"):Buffer.from(r);if("number"==typeof r)return r?(e=t(r),Buffer.from(e,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var e,n,u;return r}export{r as encode,n as getLength,u as toBuffer}; | ||
//# sourceMappingURL=rlp.modern.js.map |
@@ -1,2 +0,2 @@ | ||
function r(n){if(Array.isArray(n)){for(var f=[],u=0;u<n.length;u++)f.push(r(n[u]));var i=Buffer.concat(f);return Buffer.concat([e(i.length,192),i])}var o=t(n);return 1===o.length&&o[0]<128?o:Buffer.concat([e(o.length,128),o])}function e(r,e){if(r<56)return Buffer.from([r+e]);var n=f(r),t=f(e+55+n.length/2);return Buffer.from(t+n,"hex")}function n(r){return"0x"===r.slice(0,2)}function f(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function t(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return n(r)?Buffer.from((t="string"!=typeof(u=r)?u:n(u)?u.slice(2):u).length%2?"0"+t:t,"hex"):Buffer.from(r);if("number"==typeof r)return r?(e=f(r),Buffer.from(e,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var e,t,u;return r}exports.getLength=function(r){if(!r||0===r.length)return Buffer.from([]);var e=t(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var f=n-246;return f+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,f).toString("hex"))};export{r as encode,t as toBuffer}; | ||
function r(n){if(Array.isArray(n)){for(var f=[],t=0;t<n.length;t++)f.push(r(n[t]));var i=Buffer.concat(f);return Buffer.concat([e(i.length,192),i])}var o=u(n);return 1===o.length&&o[0]<128?o:Buffer.concat([e(o.length,128),o])}function e(r,e){if(r<56)return Buffer.from([r+e]);var n=t(r),f=t(e+55+n.length/2);return Buffer.from(f+n,"hex")}function n(r){if(!r||0===r.length)return Buffer.from([]);var e=u(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var f=n-246;return f+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,f).toString("hex"))}function f(r){return"0x"===r.slice(0,2)}function t(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function u(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return f(r)?Buffer.from((n="string"!=typeof(u=r)?u:f(u)?u.slice(2):u).length%2?"0"+n:n,"hex"):Buffer.from(r);if("number"==typeof r)return r?(e=t(r),Buffer.from(e,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var e,n,u;return r}export{r as encode,n as getLength,u as toBuffer}; | ||
//# sourceMappingURL=rlp.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r=r||self).rlp={})}(this,function(r){function e(r,e){if(r<56)return Buffer.from([r+e]);var n=f(r),t=f(e+55+n.length/2);return Buffer.from(t+n,"hex")}function n(r){return"0x"===r.slice(0,2)}function f(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function t(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return n(r)?Buffer.from((t="string"!=typeof(u=r)?u:n(u)?u.slice(2):u).length%2?"0"+t:t,"hex"):Buffer.from(r);if("number"==typeof r)return r?(e=f(r),Buffer.from(e,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var e,t,u;return r}r.getLength=function(r){if(!r||0===r.length)return Buffer.from([]);var e=t(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var f=n-246;return f+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,f).toString("hex"))},r.encode=function r(n){if(Array.isArray(n)){for(var f=[],u=0;u<n.length;u++)f.push(r(n[u]));var i=Buffer.concat(f);return Buffer.concat([e(i.length,192),i])}var o=t(n);return 1===o.length&&o[0]<128?o:Buffer.concat([e(o.length,128),o])},r.toBuffer=t}); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r=r||self).rlp={})}(this,function(r){function e(r,e){if(r<56)return Buffer.from([r+e]);var n=f(r),t=f(e+55+n.length/2);return Buffer.from(t+n,"hex")}function n(r){return"0x"===r.slice(0,2)}function f(r){if(r<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=r.toString(16);return e.length%2?"0"+e:e}function t(r){if(!Buffer.isBuffer(r)){if("string"==typeof r)return n(r)?Buffer.from((t="string"!=typeof(u=r)?u:n(u)?u.slice(2):u).length%2?"0"+t:t,"hex"):Buffer.from(r);if("number"==typeof r)return r?(e=f(r),Buffer.from(e,"hex")):Buffer.from([]);if(null==r)return Buffer.from([]);if(r instanceof Uint8Array)return Buffer.from(r);throw new Error("invalid type")}var e,t,u;return r}r.encode=function r(n){if(Array.isArray(n)){for(var f=[],u=0;u<n.length;u++)f.push(r(n[u]));var i=Buffer.concat(f);return Buffer.concat([e(i.length,192),i])}var o=t(n);return 1===o.length&&o[0]<128?o:Buffer.concat([e(o.length,128),o])},r.getLength=function(r){if(!r||0===r.length)return Buffer.from([]);var e=t(r),n=e[0];if(n<=127)return e.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var f=n-246;return f+function(r,e){if("00"===r.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(r,16)}(e.slice(1,f).toString("hex"))},r.toBuffer=t}); | ||
//# sourceMappingURL=rlp.umd.js.map |
{ | ||
"name": "@onflow/rlp", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Port of ehteriumjs/rlp", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
@@ -77,3 +77,3 @@ /** | ||
*/ | ||
function getLength(input) { | ||
export function getLength(input) { | ||
if (!input || input.length === 0) { | ||
@@ -104,3 +104,3 @@ return Buffer.from([]); | ||
} | ||
exports.getLength = getLength; | ||
/** Decode an input with RLP */ | ||
@@ -107,0 +107,0 @@ function _decode(input) { |
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
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
69889
265