Comparing version 0.2.5 to 0.2.6
@@ -199,12 +199,16 @@ var __defProp = Object.defineProperty; | ||
let inc = 4n; | ||
decoders.forEach((dec, idx) => { | ||
for (let d = 0; d < 4; d++) { | ||
inc *= 2n; | ||
const len = lengths[idx]; | ||
const len = lengths[d]; | ||
for (let i = 0; i < len; i++) { | ||
result = BigInt(dec(bytes)) << nBits | result; | ||
result = BigInt(decoders[d](bytes)) << nBits | result; | ||
nBits += inc; | ||
} | ||
}); | ||
} | ||
return result; | ||
}); | ||
var MIN_U64 = 1n << 56n; | ||
var MIN_U32 = 1 << 24; | ||
var MIN_U16 = 256; | ||
var U32_MASK = 4294967295n; | ||
var SINGLE_BYTE_MODE_LIMIT = 1 << 6; | ||
@@ -215,17 +219,29 @@ var TWO_BYTE_MODE_LIMIT = 1 << 14; | ||
if (input < 0) | ||
throw new Error(`Wrong Compat input (${input})`); | ||
throw new Error(`Wrong compact input (${input})`); | ||
const nInput = Number(input) << 2; | ||
if (input < SINGLE_BYTE_MODE_LIMIT) | ||
return u8[0](Number(input) << 2); | ||
return u8[0](nInput); | ||
if (input < TWO_BYTE_MODE_LIMIT) | ||
return u16[0](Number(input) << 2 | 1); | ||
return u16[0](nInput | 1); | ||
if (input < FOUR_BYTE_MODE_LIMIT) | ||
return u32[0](Number(input) << 2 | 2); | ||
const result = [0]; | ||
let tmp = BigInt(input); | ||
while (tmp > 0) { | ||
result.push(Number(tmp)); | ||
tmp >>= 8n; | ||
return u32[0](nInput | 2); | ||
let buffers = [new Uint8Array(1)]; | ||
let bigValue = BigInt(input); | ||
while (bigValue >= MIN_U64) { | ||
buffers.push(u64[0](bigValue)); | ||
bigValue >>= 64n; | ||
} | ||
while (bigValue >= MIN_U32) { | ||
buffers.push(u32[0](Number(bigValue & U32_MASK))); | ||
bigValue >>= 32n; | ||
} | ||
let smValue = Number(bigValue); | ||
while (smValue >= MIN_U16) { | ||
buffers.push(u16[0](smValue)); | ||
smValue >>= 16; | ||
} | ||
smValue && buffers.push(u8[0](smValue)); | ||
const result = mergeUint8(...buffers); | ||
result[0] = result.length - 5 << 2 | 3; | ||
return new Uint8Array(result); | ||
return result; | ||
}; | ||
@@ -250,4 +266,6 @@ var compact = createCodec(compactEnc, compactDec); | ||
// src/codecs/void.ts | ||
var noop = () => { | ||
}; | ||
var emptyArr = new Uint8Array(0); | ||
var _void = createCodec(() => emptyArr, Function.prototype); | ||
var _void = createCodec(() => emptyArr, noop); | ||
@@ -280,6 +298,5 @@ // src/codecs/Bytes.ts | ||
const [tag, innerDecoder] = entries[idx]; | ||
const innerResult = innerDecoder(bytes); | ||
return { | ||
tag, | ||
value: innerResult | ||
value: innerDecoder(bytes) | ||
}; | ||
@@ -318,4 +335,3 @@ }); | ||
var ResultDec = (okDecoder, koDecoder) => toInternalBytes((bytes) => { | ||
const val = u8[1](bytes); | ||
const success = val === 0; | ||
const success = u8[1](bytes) === 0; | ||
const decoder = success ? okDecoder : koDecoder; | ||
@@ -351,6 +367,6 @@ const value = decoder(bytes); | ||
// src/codecs/Vector.ts | ||
var VectorEnc = (inner, size) => size > 0 ? (value) => mergeUint8(...value.map(inner)) : (value) => mergeUint8(compact.enc(value.length), ...value.map(inner)); | ||
var VectorEnc = (inner, size) => size >= 0 ? (value) => mergeUint8(...value.map(inner)) : (value) => mergeUint8(compact.enc(value.length), ...value.map(inner)); | ||
function VectorDec(getter, size) { | ||
return toInternalBytes((bytes) => { | ||
const nElements = size > 0 ? size : compact.dec(bytes); | ||
const nElements = size >= 0 ? size : compact.dec(bytes); | ||
const result = new Array(nElements); | ||
@@ -357,0 +373,0 @@ for (let i = 0; i < nElements; i++) { |
@@ -1,2 +0,2 @@ | ||
var D=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var ae=(e,n,t)=>n in e?D(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var me=(e,n)=>{for(var t in n)D(e,t,{get:n[t],enumerable:!0})},ue=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of se(n))!ie.call(e,r)&&r!==t&&D(e,r,{get:()=>n[r],enumerable:!(o=de(n,r))||o.enumerable});return e};var fe=e=>ue(D({},"__esModule",{value:!0}),e);var v=(e,n,t)=>(ae(e,typeof n!="symbol"?n+"":n,t),t);var Ve={};me(Ve,{Bytes:()=>b,Enum:()=>A,Option:()=>C,Result:()=>K,Struct:()=>I,Tuple:()=>p,Vector:()=>w,_void:()=>F,bool:()=>O,compact:()=>f,createCodec:()=>c,enhanceCodec:()=>R,enhanceDecoder:()=>x,enhanceEncoder:()=>l,i128:()=>Te,i16:()=>le,i32:()=>xe,i64:()=>ge,i8:()=>De,str:()=>P,u128:()=>Ee,u16:()=>E,u32:()=>T,u64:()=>h,u8:()=>i});module.exports=fe(Ve);var c=(e,n)=>{let t=[e,n];return t.enc=e,t.dec=n,t},l=(e,n)=>t=>e(n(t)),x=(e,n)=>t=>n(e(t)),R=([e,n],t,o)=>c(l(e,t),x(n,o));var V={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function pe(e){let n=e.length%2,t=(e[1]==="x"?2:0)+n,o=(e.length-t)/2+n,r=new Uint8Array(o);n&&(r[0]=0|V[e[2]]);for(let s=0;s<o;){let a=t+s*2,k=V[e[a]],B=V[e[a+1]];r[n+s++]=k<<4|B}return r}var g=class extends Uint8Array{constructor(t){super(t);v(this,"i",0);v(this,"v");this.v=new DataView(t)}},d=e=>n=>e(n instanceof g?n:new g(typeof n=="string"?pe(n).buffer:n instanceof Uint8Array?n.buffer:n));var m=(...e)=>{let n=e.reduce((o,r)=>o+r.byteLength,0),t=new Uint8Array(n);for(let o=0,r=0;o<e.length;o++){let s=e[o];t.set(s,r),r+=s.byteLength}return t};function y(e,n){return Object.fromEntries(Object.entries(e).map(([t,o])=>[t,n(o,t)]))}function ye(e,n){return d(t=>{let o=t.v[n](t.i,!0);return t.i+=e,o})}function Oe(e,n){return t=>{let o=new Uint8Array(e);return new DataView(o.buffer)[n](0,t,!0),o}}function u(e,n,t){return c(Oe(e,t),ye(e,n))}var i=u(1,"getUint8","setUint8"),E=u(2,"getUint16","setUint16"),T=u(4,"getUint32","setUint32"),h=u(8,"getBigUint64","setBigUint64"),De=u(1,"getInt8","setInt8"),le=u(2,"getInt16","setInt16"),xe=u(4,"getInt32","setInt32"),ge=u(8,"getBigInt64","setBigInt64"),S=e=>{let n=new Uint8Array(16),t=new DataView(n.buffer);return t.setBigInt64(0,e,!0),t.setBigInt64(8,e>>64n,!0),n},M=e=>d(n=>{let{v:t,i:o}=n,r=t.getBigUint64(o,!0),s=t[e?"getBigInt64":"getBigUint64"](o+8,!0);return n.i+=16,s<<64n|r}),Ee=c(S,M()),Te=c(S,M(1));var be=e=>e?1:0,O=R(i,be,Boolean);var N=[i[1],E[1],T[1],h[1]],Ae=d(e=>{let n=e.i,t=e[n],o=t&3;if(o!==3)return N[o](e)>>>2;let r=(t>>>2)+4;e.i++;let s=r/8|0,a=r%8,k=a/4|0;a%=4;let B=[a%2,a/2|0,k,s],U=0n,j=0n,_=4n;return N.forEach((oe,re)=>{_*=2n;let ce=B[re];for(let L=0;L<ce;L++)U=BigInt(oe(e))<<j|U,j+=_}),U}),Ce=1<<6,Ke=1<<14,Ie=1<<30,we=e=>{if(e<0)throw new Error(`Wrong Compat input (${e})`);if(e<Ce)return i[0](Number(e)<<2);if(e<Ke)return E[0](Number(e)<<2|1);if(e<Ie)return T[0](Number(e)<<2|2);let n=[0],t=BigInt(e);for(;t>0;)n.push(Number(t)),t>>=8n;return n[0]=n.length-5<<2|3,new Uint8Array(n)},f=c(we,Ae);var ke=new TextEncoder,Be=e=>{let n=ke.encode(e);return m(f.enc(n.length),n)},Ue=new TextDecoder,ve=d(e=>{let n=f.dec(e),t=new DataView(e.buffer,e.i,n);return e.i+=n,Ue.decode(t)}),P=c(Be,ve);var Re=new Uint8Array(0),F=c(()=>Re,Function.prototype);var Y=e=>n=>n.length===e?n:n.slice(0,e),H=e=>d(n=>{let t=n.i,o=e!==1/0?e:n.byteLength-t,r=new Uint8Array(n.buffer,t,o);return n.i+=o,r}),b=e=>c(Y(e),H(e));b.enc=Y;b.dec=H;var W=e=>{let n=Object.keys(e);return({tag:t,value:o})=>{let r=n.indexOf(t);return m(i.enc(r),e[t](o))}},G=e=>{let n=Object.entries(e);return d(t=>{let o=i.dec(t),[r,s]=n[o],a=s(t);return{tag:r,value:a}})},A=e=>c(W(y(e,([n])=>n)),G(y(e,([,n])=>n)));A.enc=W;A.dec=G;var X=e=>d(n=>{let t=i.dec(n);if(t!==0)return e===O[1]?t===1:e(n)}),$=e=>n=>{let t=new Uint8Array(1);return n===void 0?(t[0]=0,t):(t[0]=1,e===O[0]?(t[0]=n?1:2,t):m(t,e(n)))},C=e=>c($(e[0]),X(e[1]));C.enc=$;C.dec=X;var q=(e,n)=>d(t=>{let r=i[1](t)===0,a=(r?e:n)(t);return{success:r,value:a}}),J=(e,n)=>({success:t,value:o})=>m(i[0](t?0:1),(t?e:n)(o)),K=(e,n)=>c(J(e[0],n[0]),q(e[1],n[1]));K.dec=q;K.enc=J;var Q=(...e)=>d(n=>e.map(t=>t(n))),Z=(...e)=>n=>m(...n.map((t,o)=>e[o](t))),p=(...e)=>c(Z(...e.map(([n])=>n)),Q(...e.map(([,n])=>n)));p.enc=Z;p.dec=Q;var z=e=>{let n=Object.keys(e);return l(p.enc(...Object.values(e)),t=>n.map(o=>t[o]))},ee=e=>{let n=Object.keys(e);return x(p.dec(...Object.values(e)),t=>Object.fromEntries(t.map((o,r)=>[n[r],o])))},I=e=>c(z(y(e,n=>n[0])),ee(y(e,n=>n[1])));I.enc=z;I.dec=ee;var ne=(e,n)=>n>0?t=>m(...t.map(e)):t=>m(f.enc(t.length),...t.map(e));function te(e,n){return d(t=>{let o=n>0?n:f.dec(t),r=new Array(o);for(let s=0;s<o;s++){let a=e(t);r[s]=a}return r})}function w(e,n){return c(ne(e[0],n),te(e[1],n))}w.enc=ne;w.dec=te; | ||
var g=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var ie=(e,n,t)=>n in e?g(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var ae=(e,n)=>{for(var t in n)g(e,t,{get:n[t],enumerable:!0})},ue=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of de(n))!se.call(e,r)&&r!==t&&g(e,r,{get:()=>n[r],enumerable:!(o=ce(n,r))||o.enumerable});return e};var me=e=>ue(g({},"__esModule",{value:!0}),e);var V=(e,n,t)=>(ie(e,typeof n!="symbol"?n+"":n,t),t);var Me={};ae(Me,{Bytes:()=>I,Enum:()=>K,Option:()=>C,Result:()=>w,Struct:()=>U,Tuple:()=>p,Vector:()=>k,_void:()=>F,bool:()=>D,compact:()=>f,createCodec:()=>c,enhanceCodec:()=>h,enhanceDecoder:()=>T,enhanceEncoder:()=>E,i128:()=>Ee,i16:()=>le,i32:()=>De,i64:()=>xe,i8:()=>Oe,str:()=>Y,u128:()=>ge,u16:()=>O,u32:()=>l,u64:()=>A,u8:()=>a});module.exports=me(Me);var c=(e,n)=>{let t=[e,n];return t.enc=e,t.dec=n,t},E=(e,n)=>t=>e(n(t)),T=(e,n)=>t=>n(e(t)),h=([e,n],t,o)=>c(E(e,t),T(n,o));var _={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function fe(e){let n=e.length%2,t=(e[1]==="x"?2:0)+n,o=(e.length-t)/2+n,r=new Uint8Array(o);n&&(r[0]=0|_[e[2]]);for(let d=0;d<o;){let u=t+d*2,B=_[e[u]],v=_[e[u+1]];r[n+d++]=B<<4|v}return r}var b=class extends Uint8Array{constructor(t){super(t);V(this,"i",0);V(this,"v");this.v=new DataView(t)}},s=e=>n=>e(n instanceof b?n:new b(typeof n=="string"?fe(n).buffer:n instanceof Uint8Array?n.buffer:n));var i=(...e)=>{let n=e.reduce((o,r)=>o+r.byteLength,0),t=new Uint8Array(n);for(let o=0,r=0;o<e.length;o++){let d=e[o];t.set(d,r),r+=d.byteLength}return t};function y(e,n){return Object.fromEntries(Object.entries(e).map(([t,o])=>[t,n(o,t)]))}function pe(e,n){return s(t=>{let o=t.v[n](t.i,!0);return t.i+=e,o})}function ye(e,n){return t=>{let o=new Uint8Array(e);return new DataView(o.buffer)[n](0,t,!0),o}}function m(e,n,t){return c(ye(e,t),pe(e,n))}var a=m(1,"getUint8","setUint8"),O=m(2,"getUint16","setUint16"),l=m(4,"getUint32","setUint32"),A=m(8,"getBigUint64","setBigUint64"),Oe=m(1,"getInt8","setInt8"),le=m(2,"getInt16","setInt16"),De=m(4,"getInt32","setInt32"),xe=m(8,"getBigInt64","setBigInt64"),L=e=>{let n=new Uint8Array(16),t=new DataView(n.buffer);return t.setBigInt64(0,e,!0),t.setBigInt64(8,e>>64n,!0),n},N=e=>s(n=>{let{v:t,i:o}=n,r=t.getBigUint64(o,!0),d=t[e?"getBigInt64":"getBigUint64"](o+8,!0);return n.i+=16,d<<64n|r}),ge=c(L,N()),Ee=c(L,N(1));var Te=e=>e?1:0,D=h(a,Te,Boolean);var P=[a[1],O[1],l[1],A[1]],be=s(e=>{let n=e.i,t=e[n],o=t&3;if(o!==3)return P[o](e)>>>2;let r=(t>>>2)+4;e.i++;let d=r/8|0,u=r%8,B=u/4|0;u%=4;let v=[u%2,u/2|0,B,d],R=0n,j=0n,M=4n;for(let x=0;x<4;x++){M*=2n;let re=v[x];for(let S=0;S<re;S++)R=BigInt(P[x](e))<<j|R,j+=M}return R}),Ae=1n<<56n,Ie=1<<24,Ke=256,Ce=4294967295n,we=1<<6,Ue=1<<14,ke=1<<30,Be=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);let n=Number(e)<<2;if(e<we)return a[0](n);if(e<Ue)return O[0](n|1);if(e<ke)return l[0](n|2);let t=[new Uint8Array(1)],o=BigInt(e);for(;o>=Ae;)t.push(A[0](o)),o>>=64n;for(;o>=Ie;)t.push(l[0](Number(o&Ce))),o>>=32n;let r=Number(o);for(;r>=Ke;)t.push(O[0](r)),r>>=16;r&&t.push(a[0](r));let d=i(...t);return d[0]=d.length-5<<2|3,d},f=c(Be,be);var ve=new TextEncoder,Re=e=>{let n=ve.encode(e);return i(f.enc(n.length),n)},Ve=new TextDecoder,he=s(e=>{let n=f.dec(e),t=new DataView(e.buffer,e.i,n);return e.i+=n,Ve.decode(t)}),Y=c(Re,he);var _e=()=>{},je=new Uint8Array(0),F=c(()=>je,_e);var H=e=>n=>n.length===e?n:n.slice(0,e),W=e=>s(n=>{let t=n.i,o=e!==1/0?e:n.byteLength-t,r=new Uint8Array(n.buffer,t,o);return n.i+=o,r}),I=e=>c(H(e),W(e));I.enc=H;I.dec=W;var G=e=>{let n=Object.keys(e);return({tag:t,value:o})=>{let r=n.indexOf(t);return i(a.enc(r),e[t](o))}},X=e=>{let n=Object.entries(e);return s(t=>{let o=a.dec(t),[r,d]=n[o];return{tag:r,value:d(t)}})},K=e=>c(G(y(e,([n])=>n)),X(y(e,([,n])=>n)));K.enc=G;K.dec=X;var $=e=>s(n=>{let t=a.dec(n);if(t!==0)return e===D[1]?t===1:e(n)}),q=e=>n=>{let t=new Uint8Array(1);return n===void 0?(t[0]=0,t):(t[0]=1,e===D[0]?(t[0]=n?1:2,t):i(t,e(n)))},C=e=>c(q(e[0]),$(e[1]));C.enc=q;C.dec=$;var J=(e,n)=>s(t=>{let o=a[1](t)===0,d=(o?e:n)(t);return{success:o,value:d}}),Q=(e,n)=>({success:t,value:o})=>i(a[0](t?0:1),(t?e:n)(o)),w=(e,n)=>c(Q(e[0],n[0]),J(e[1],n[1]));w.dec=J;w.enc=Q;var Z=(...e)=>s(n=>e.map(t=>t(n))),z=(...e)=>n=>i(...n.map((t,o)=>e[o](t))),p=(...e)=>c(z(...e.map(([n])=>n)),Z(...e.map(([,n])=>n)));p.enc=z;p.dec=Z;var ee=e=>{let n=Object.keys(e);return E(p.enc(...Object.values(e)),t=>n.map(o=>t[o]))},ne=e=>{let n=Object.keys(e);return T(p.dec(...Object.values(e)),t=>Object.fromEntries(t.map((o,r)=>[n[r],o])))},U=e=>c(ee(y(e,n=>n[0])),ne(y(e,n=>n[1])));U.enc=ee;U.dec=ne;var te=(e,n)=>n>=0?t=>i(...t.map(e)):t=>i(f.enc(t.length),...t.map(e));function oe(e,n){return s(t=>{let o=n>=0?n:f.dec(t),r=new Array(o);for(let d=0;d<o;d++){let u=e(t);r[d]=u}return r})}function k(e,n){return c(te(e[0],n),oe(e[1],n))}k.enc=te;k.dec=oe; | ||
//# sourceMappingURL=scale-ts.cjs.production.min.js.map |
@@ -152,12 +152,16 @@ var __defProp = Object.defineProperty; | ||
let inc = 4n; | ||
decoders.forEach((dec, idx) => { | ||
for (let d = 0; d < 4; d++) { | ||
inc *= 2n; | ||
const len = lengths[idx]; | ||
const len = lengths[d]; | ||
for (let i = 0; i < len; i++) { | ||
result = BigInt(dec(bytes)) << nBits | result; | ||
result = BigInt(decoders[d](bytes)) << nBits | result; | ||
nBits += inc; | ||
} | ||
}); | ||
} | ||
return result; | ||
}); | ||
var MIN_U64 = 1n << 56n; | ||
var MIN_U32 = 1 << 24; | ||
var MIN_U16 = 256; | ||
var U32_MASK = 4294967295n; | ||
var SINGLE_BYTE_MODE_LIMIT = 1 << 6; | ||
@@ -168,17 +172,29 @@ var TWO_BYTE_MODE_LIMIT = 1 << 14; | ||
if (input < 0) | ||
throw new Error(`Wrong Compat input (${input})`); | ||
throw new Error(`Wrong compact input (${input})`); | ||
const nInput = Number(input) << 2; | ||
if (input < SINGLE_BYTE_MODE_LIMIT) | ||
return u8[0](Number(input) << 2); | ||
return u8[0](nInput); | ||
if (input < TWO_BYTE_MODE_LIMIT) | ||
return u16[0](Number(input) << 2 | 1); | ||
return u16[0](nInput | 1); | ||
if (input < FOUR_BYTE_MODE_LIMIT) | ||
return u32[0](Number(input) << 2 | 2); | ||
const result = [0]; | ||
let tmp = BigInt(input); | ||
while (tmp > 0) { | ||
result.push(Number(tmp)); | ||
tmp >>= 8n; | ||
return u32[0](nInput | 2); | ||
let buffers = [new Uint8Array(1)]; | ||
let bigValue = BigInt(input); | ||
while (bigValue >= MIN_U64) { | ||
buffers.push(u64[0](bigValue)); | ||
bigValue >>= 64n; | ||
} | ||
while (bigValue >= MIN_U32) { | ||
buffers.push(u32[0](Number(bigValue & U32_MASK))); | ||
bigValue >>= 32n; | ||
} | ||
let smValue = Number(bigValue); | ||
while (smValue >= MIN_U16) { | ||
buffers.push(u16[0](smValue)); | ||
smValue >>= 16; | ||
} | ||
smValue && buffers.push(u8[0](smValue)); | ||
const result = mergeUint8(...buffers); | ||
result[0] = result.length - 5 << 2 | 3; | ||
return new Uint8Array(result); | ||
return result; | ||
}; | ||
@@ -203,4 +219,6 @@ var compact = createCodec(compactEnc, compactDec); | ||
// src/codecs/void.ts | ||
var noop = () => { | ||
}; | ||
var emptyArr = new Uint8Array(0); | ||
var _void = createCodec(() => emptyArr, Function.prototype); | ||
var _void = createCodec(() => emptyArr, noop); | ||
@@ -233,6 +251,5 @@ // src/codecs/Bytes.ts | ||
const [tag, innerDecoder] = entries[idx]; | ||
const innerResult = innerDecoder(bytes); | ||
return { | ||
tag, | ||
value: innerResult | ||
value: innerDecoder(bytes) | ||
}; | ||
@@ -271,4 +288,3 @@ }); | ||
var ResultDec = (okDecoder, koDecoder) => toInternalBytes((bytes) => { | ||
const val = u8[1](bytes); | ||
const success = val === 0; | ||
const success = u8[1](bytes) === 0; | ||
const decoder = success ? okDecoder : koDecoder; | ||
@@ -304,6 +320,6 @@ const value = decoder(bytes); | ||
// src/codecs/Vector.ts | ||
var VectorEnc = (inner, size) => size > 0 ? (value) => mergeUint8(...value.map(inner)) : (value) => mergeUint8(compact.enc(value.length), ...value.map(inner)); | ||
var VectorEnc = (inner, size) => size >= 0 ? (value) => mergeUint8(...value.map(inner)) : (value) => mergeUint8(compact.enc(value.length), ...value.map(inner)); | ||
function VectorDec(getter, size) { | ||
return toInternalBytes((bytes) => { | ||
const nElements = size > 0 ? size : compact.dec(bytes); | ||
const nElements = size >= 0 ? size : compact.dec(bytes); | ||
const result = new Array(nElements); | ||
@@ -310,0 +326,0 @@ for (let i = 0; i < nElements; i++) { |
{ | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"repository": { | ||
@@ -4,0 +4,0 @@ "type": "git", |
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
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
163394
1218