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

scale-ts

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scale-ts - npm Package Compare versions

Comparing version 1.4.2 to 1.4.3

21

dist/scale-ts.cjs.development.js

@@ -109,3 +109,3 @@ var __defProp = Object.defineProperty;

// src/internal/mergeUint8.ts
var mergeUint8 = (...inputs) => {
var mergeUint8 = (inputs) => {
const len = inputs.length;

@@ -281,3 +281,3 @@ let totalLen = 0;

smValue && buffers.push(u8[0](smValue));
const result = mergeUint8(...buffers);
const result = mergeUint8(buffers);
result[0] = result.length - 5 << 2 | 3;

@@ -292,3 +292,3 @@ return result;

const val = textEncoder.encode(str2);
return mergeUint8(compact.enc(val.length), val);
return mergeUint8([compact.enc(val.length), val]);
};

@@ -311,3 +311,3 @@ var textDecoder = new TextDecoder();

// src/codecs/Bytes.ts
var BytesEnc = (nBytes) => nBytes === void 0 ? (bytes) => mergeUint8(compact.enc(bytes.length), bytes) : (bytes) => bytes.length === nBytes ? bytes : bytes.slice(0, nBytes);
var BytesEnc = (nBytes) => nBytes === void 0 ? (bytes) => mergeUint8([compact.enc(bytes.length), bytes]) : (bytes) => bytes.length === nBytes ? bytes : bytes.slice(0, nBytes);
var BytesDec = (nBytes) => toInternalBytes((bytes) => {

@@ -328,3 +328,3 @@ const len = nBytes === void 0 ? compact.dec(bytes) : nBytes !== Infinity ? nBytes : bytes.byteLength - bytes.i;

const getKey = (key) => mappedKeys.get(key);
return ({ tag, value }) => mergeUint8(u8.enc(getKey(tag)), inner[tag](value));
return ({ tag, value }) => mergeUint8([u8.enc(getKey(tag)), inner[tag](value)]);
};

@@ -366,3 +366,3 @@ var enumDec = (inner, x) => {

}
return mergeUint8(result, inner(value));
return mergeUint8([result, inner(value)]);
};

@@ -380,3 +380,6 @@ var Option = (inner) => createCodec(OptionEnc(inner[0]), OptionDec(inner[1]));

});
var ResultEnc = (okEncoder, koEncoder) => ({ success, value }) => mergeUint8(u8[0](success ? 0 : 1), (success ? okEncoder : koEncoder)(value));
var ResultEnc = (okEncoder, koEncoder) => ({ success, value }) => mergeUint8([
u8[0](success ? 0 : 1),
(success ? okEncoder : koEncoder)(value)
]);
var Result = (okCodec, koCodec) => createCodec(ResultEnc(okCodec[0], koCodec[0]), ResultDec(okCodec[1], koCodec[1]));

@@ -388,3 +391,3 @@ Result.dec = ResultDec;

var TupleDec = (...decoders2) => toInternalBytes((bytes) => decoders2.map((decoder) => decoder(bytes)));
var TupleEnc = (...encoders) => (values) => mergeUint8(...values.map((value, idx) => encoders[idx](value)));
var TupleEnc = (...encoders) => (values) => mergeUint8(values.map((value, idx) => encoders[idx](value)));
var Tuple = (...codecs) => createCodec(TupleEnc(...codecs.map(([encoder]) => encoder)), TupleDec(...codecs.map(([, decoder]) => decoder)));

@@ -408,3 +411,3 @@ Tuple.enc = TupleEnc;

// 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), mergeUint8(value.map(inner))]);
var VectorDec = (getter, size) => toInternalBytes((bytes) => {

@@ -411,0 +414,0 @@ const nElements = size >= 0 ? size : compact.dec(bytes);

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

var x=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var re=(t,e,n)=>e in t?x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var oe=(t,e)=>{for(var n in e)x(t,n,{get:e[n],enumerable:!0})},ce=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of te(e))!ne.call(t,r)&&r!==n&&x(t,r,{get:()=>e[r],enumerable:!(o=ee(e,r))||o.enumerable});return t};var ie=t=>ce(x({},"__esModule",{value:!0}),t);var R=(t,e,n)=>(re(t,typeof e!="symbol"?e+"":e,n),n);var Le={};oe(Le,{Bytes:()=>U,Enum:()=>C,Option:()=>b,Result:()=>k,Struct:()=>B,Tuple:()=>y,Vector:()=>w,_void:()=>j,bool:()=>D,compact:()=>u,createCodec:()=>i,createDecoder:()=>se,enhanceCodec:()=>V,enhanceDecoder:()=>A,enhanceEncoder:()=>I,i128:()=>le,i16:()=>fe,i256:()=>De,i32:()=>pe,i64:()=>ye,i8:()=>ue,str:()=>M,u128:()=>ge,u16:()=>l,u256:()=>Oe,u32:()=>O,u64:()=>K,u8:()=>m});module.exports=ie(Le);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 de(t){let e=t.length%2,n=(t[1]==="x"?2:0)+e,o=(t.length-n)/2+e,r=new Uint8Array(o);e&&(r[0]=0|v[t[2]]);for(let c=0;c<o;){let d=n+c*2,f=v[t[d]],T=v[t[d+1]];r[e+c++]=f<<4|T}return r}var E=class extends Uint8Array{constructor(n){super(n);R(this,"i",0);R(this,"v");this.v=new DataView(n)}},s=t=>e=>t(e instanceof E?e:new E(e instanceof Uint8Array?e.buffer:typeof e=="string"?de(e).buffer:e));var a=(...t)=>{let e=t.length,n=0;for(let r=0;r<e;r++)n+=t[r].byteLength;let o=new Uint8Array(n);for(let r=0,c=0;r<e;r++){let d=t[r];o.set(d,c),c+=d.byteLength}return o};function g(t,e){let n=Object.keys(t),o=n.length,r={};for(let c=0;c<o;c++){let d=n[c];r[d]=e(t[d],d)}return r}var se=s,i=(t,e)=>{let n=[t,e];return n.enc=t,n.dec=e,n},I=(t,e)=>n=>t(e(n)),A=(t,e)=>n=>e(t(n)),V=([t,e],n,o)=>i(I(t,n),A(e,o));function ae(t,e){return s(n=>{let o=n.v[e](n.i,!0);return n.i+=t,o})}function me(t,e){return n=>{let o=new Uint8Array(t);return new DataView(o.buffer)[e](0,n,!0),o}}function p(t,e,n){return i(me(t,n),ae(t,e))}var m=p(1,"getUint8","setUint8"),l=p(2,"getUint16","setUint16"),O=p(4,"getUint32","setUint32"),K=p(8,"getBigUint64","setBigUint64"),ue=p(1,"getInt8","setInt8"),fe=p(2,"getInt16","setInt16"),pe=p(4,"getInt32","setInt32"),ye=p(8,"getBigInt64","setBigInt64"),h=t=>{let e=new Uint8Array(16),n=new DataView(e.buffer);return n.setBigInt64(0,t,!0),n.setBigInt64(8,t>>64n,!0),e},L=t=>s(e=>{let{v:n,i:o}=e,r=n.getBigUint64(o,!0),c=n[t](o+8,!0);return e.i+=16,c<<64n|r}),ge=i(h,L("getBigUint64")),le=i(h,L("getBigInt64")),_=t=>{let e=new Uint8Array(32),n=new DataView(e.buffer);return n.setBigInt64(0,t,!0),n.setBigInt64(8,t>>64n,!0),n.setBigInt64(16,t>>128n,!0),n.setBigInt64(24,t>>192n,!0),e},S=t=>s(e=>{let n=e.v.getBigUint64(e.i,!0);return e.i+=8,n|=e.v.getBigUint64(e.i,!0)<<64n,e.i+=8,n|=e.v.getBigUint64(e.i,!0)<<128n,e.i+=8,n|=e.v[t](e.i,!0)<<192n,e.i+=8,n}),Oe=i(_,S("getBigUint64")),De=i(_,S("getBigInt64"));var D=V(m,t=>t?1:0,Boolean);var Te=[m[1],l[1],O[1]],xe=s(t=>{let e=t[t.i],n=e&3;if(n<3)return Te[n](t)>>>2;let o=(e>>>2)+4;t.i++;let r=0n,c=o/8|0,d=0n;for(let T=0;T<c;T++)r=K[1](t)<<d|r,d+=64n;let f=o%8;return f>3&&(r=BigInt(O[1](t))<<d|r,d+=32n,f-=4),f>1&&(r=BigInt(l[1](t))<<d|r,d+=16n,f-=2),f&&(r=BigInt(m[1](t))<<d|r),r}),Ee=1n<<56n,Ie=1<<24,Ae=256,Ke=4294967295n,Ue=1<<6,Ce=1<<14,be=1<<30,ke=t=>{if(t<0)throw new Error(`Wrong compact input (${t})`);let e=Number(t)<<2;if(t<Ue)return m[0](e);if(t<Ce)return l[0](e|1);if(t<be)return O[0](e|2);let n=[new Uint8Array(1)],o=BigInt(t);for(;o>=Ee;)n.push(K[0](o)),o>>=64n;o>=Ie&&(n.push(O[0](Number(o&Ke))),o>>=32n);let r=Number(o);r>=Ae&&(n.push(l[0](r)),r>>=16),r&&n.push(m[0](r));let c=a(...n);return c[0]=c.length-5<<2|3,c},u=i(ke,xe);var Be=new TextEncoder,we=t=>{let e=Be.encode(t);return a(u.enc(e.length),e)},Re=new TextDecoder,ve=s(t=>{let e=u.dec(t),n=new DataView(t.buffer,t.i,e);return t.i+=e,Re.decode(n)}),M=i(we,ve);var Ve=()=>{},he=new Uint8Array(0),j=i(()=>he,Ve);var N=t=>t===void 0?e=>a(u.enc(e.length),e):e=>e.length===t?e:e.slice(0,t),P=t=>s(e=>{let n=t===void 0?u.dec(e):t!==1/0?t:e.byteLength-e.i,o=new Uint8Array(e.buffer.slice(e.i,e.i+n));return e.i+=n,o}),U=t=>i(N(t),P(t));U.enc=N;U.dec=P;var Y=(t,e)=>{let n=Object.keys(t),o=new Map(e?.map((c,d)=>[n[d],c])??n.map((c,d)=>[c,d])),r=c=>o.get(c);return({tag:c,value:d})=>a(m.enc(r(c)),t[c](d))},F=(t,e)=>{let n=Object.keys(t),o=new Map(e?.map((r,c)=>[r,n[c]])??n.map((r,c)=>[c,r]));return s(r=>{let c=m.dec(r),d=o.get(c),f=t[d];return{tag:d,value:f(r)}})},C=(t,...e)=>i(Y(g(t,([n])=>n),...e),F(g(t,([,n])=>n),...e));C.enc=Y;C.dec=F;var H=t=>s(e=>{let n=m.dec(e);if(n!==0)return t===D[1]?n===1:t(e)}),W=t=>e=>{let n=new Uint8Array(1);return e===void 0?(n[0]=0,n):(n[0]=1,t===D[0]?(n[0]=e?1:2,n):a(n,t(e)))},b=t=>i(W(t[0]),H(t[1]));b.enc=W;b.dec=H;var G=(t,e)=>s(n=>{let o=m[1](n)===0,c=(o?t:e)(n);return{success:o,value:c}}),X=(t,e)=>({success:n,value:o})=>a(m[0](n?0:1),(n?t:e)(o)),k=(t,e)=>i(X(t[0],e[0]),G(t[1],e[1]));k.dec=G;k.enc=X;var $=(...t)=>s(e=>t.map(n=>n(e))),q=(...t)=>e=>a(...e.map((n,o)=>t[o](n))),y=(...t)=>i(q(...t.map(([e])=>e)),$(...t.map(([,e])=>e)));y.enc=q;y.dec=$;var J=t=>{let e=Object.keys(t);return I(y.enc(...Object.values(t)),n=>e.map(o=>n[o]))},Q=t=>{let e=Object.keys(t);return A(y.dec(...Object.values(t)),n=>Object.fromEntries(n.map((o,r)=>[e[r],o])))},B=t=>i(J(g(t,e=>e[0])),Q(g(t,e=>e[1])));B.enc=J;B.dec=Q;var Z=(t,e)=>e>=0?n=>a(...n.map(t)):n=>a(u.enc(n.length),...n.map(t)),z=(t,e)=>s(n=>{let o=e>=0?e:u.dec(n),r=new Array(o);for(let c=0;c<o;c++)r[c]=t(n);return r}),w=(t,e)=>i(Z(t[0],e),z(t[1],e));w.enc=Z;w.dec=z;
var x=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var re=(t,e,n)=>e in t?x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var oe=(t,e)=>{for(var n in e)x(t,n,{get:e[n],enumerable:!0})},ce=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of te(e))!ne.call(t,r)&&r!==n&&x(t,r,{get:()=>e[r],enumerable:!(o=ee(e,r))||o.enumerable});return t};var ie=t=>ce(x({},"__esModule",{value:!0}),t);var R=(t,e,n)=>(re(t,typeof e!="symbol"?e+"":e,n),n);var Le={};oe(Le,{Bytes:()=>U,Enum:()=>C,Option:()=>b,Result:()=>k,Struct:()=>B,Tuple:()=>y,Vector:()=>w,_void:()=>j,bool:()=>D,compact:()=>u,createCodec:()=>i,createDecoder:()=>se,enhanceCodec:()=>V,enhanceDecoder:()=>A,enhanceEncoder:()=>I,i128:()=>le,i16:()=>fe,i256:()=>De,i32:()=>pe,i64:()=>ye,i8:()=>ue,str:()=>M,u128:()=>ge,u16:()=>l,u256:()=>Oe,u32:()=>O,u64:()=>K,u8:()=>m});module.exports=ie(Le);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 de(t){let e=t.length%2,n=(t[1]==="x"?2:0)+e,o=(t.length-n)/2+e,r=new Uint8Array(o);e&&(r[0]=0|v[t[2]]);for(let c=0;c<o;){let d=n+c*2,f=v[t[d]],T=v[t[d+1]];r[e+c++]=f<<4|T}return r}var E=class extends Uint8Array{constructor(n){super(n);R(this,"i",0);R(this,"v");this.v=new DataView(n)}},s=t=>e=>t(e instanceof E?e:new E(e instanceof Uint8Array?e.buffer:typeof e=="string"?de(e).buffer:e));var a=t=>{let e=t.length,n=0;for(let r=0;r<e;r++)n+=t[r].byteLength;let o=new Uint8Array(n);for(let r=0,c=0;r<e;r++){let d=t[r];o.set(d,c),c+=d.byteLength}return o};function g(t,e){let n=Object.keys(t),o=n.length,r={};for(let c=0;c<o;c++){let d=n[c];r[d]=e(t[d],d)}return r}var se=s,i=(t,e)=>{let n=[t,e];return n.enc=t,n.dec=e,n},I=(t,e)=>n=>t(e(n)),A=(t,e)=>n=>e(t(n)),V=([t,e],n,o)=>i(I(t,n),A(e,o));function ae(t,e){return s(n=>{let o=n.v[e](n.i,!0);return n.i+=t,o})}function me(t,e){return n=>{let o=new Uint8Array(t);return new DataView(o.buffer)[e](0,n,!0),o}}function p(t,e,n){return i(me(t,n),ae(t,e))}var m=p(1,"getUint8","setUint8"),l=p(2,"getUint16","setUint16"),O=p(4,"getUint32","setUint32"),K=p(8,"getBigUint64","setBigUint64"),ue=p(1,"getInt8","setInt8"),fe=p(2,"getInt16","setInt16"),pe=p(4,"getInt32","setInt32"),ye=p(8,"getBigInt64","setBigInt64"),h=t=>{let e=new Uint8Array(16),n=new DataView(e.buffer);return n.setBigInt64(0,t,!0),n.setBigInt64(8,t>>64n,!0),e},L=t=>s(e=>{let{v:n,i:o}=e,r=n.getBigUint64(o,!0),c=n[t](o+8,!0);return e.i+=16,c<<64n|r}),ge=i(h,L("getBigUint64")),le=i(h,L("getBigInt64")),_=t=>{let e=new Uint8Array(32),n=new DataView(e.buffer);return n.setBigInt64(0,t,!0),n.setBigInt64(8,t>>64n,!0),n.setBigInt64(16,t>>128n,!0),n.setBigInt64(24,t>>192n,!0),e},S=t=>s(e=>{let n=e.v.getBigUint64(e.i,!0);return e.i+=8,n|=e.v.getBigUint64(e.i,!0)<<64n,e.i+=8,n|=e.v.getBigUint64(e.i,!0)<<128n,e.i+=8,n|=e.v[t](e.i,!0)<<192n,e.i+=8,n}),Oe=i(_,S("getBigUint64")),De=i(_,S("getBigInt64"));var D=V(m,t=>t?1:0,Boolean);var Te=[m[1],l[1],O[1]],xe=s(t=>{let e=t[t.i],n=e&3;if(n<3)return Te[n](t)>>>2;let o=(e>>>2)+4;t.i++;let r=0n,c=o/8|0,d=0n;for(let T=0;T<c;T++)r=K[1](t)<<d|r,d+=64n;let f=o%8;return f>3&&(r=BigInt(O[1](t))<<d|r,d+=32n,f-=4),f>1&&(r=BigInt(l[1](t))<<d|r,d+=16n,f-=2),f&&(r=BigInt(m[1](t))<<d|r),r}),Ee=1n<<56n,Ie=1<<24,Ae=256,Ke=4294967295n,Ue=1<<6,Ce=1<<14,be=1<<30,ke=t=>{if(t<0)throw new Error(`Wrong compact input (${t})`);let e=Number(t)<<2;if(t<Ue)return m[0](e);if(t<Ce)return l[0](e|1);if(t<be)return O[0](e|2);let n=[new Uint8Array(1)],o=BigInt(t);for(;o>=Ee;)n.push(K[0](o)),o>>=64n;o>=Ie&&(n.push(O[0](Number(o&Ke))),o>>=32n);let r=Number(o);r>=Ae&&(n.push(l[0](r)),r>>=16),r&&n.push(m[0](r));let c=a(n);return c[0]=c.length-5<<2|3,c},u=i(ke,xe);var Be=new TextEncoder,we=t=>{let e=Be.encode(t);return a([u.enc(e.length),e])},Re=new TextDecoder,ve=s(t=>{let e=u.dec(t),n=new DataView(t.buffer,t.i,e);return t.i+=e,Re.decode(n)}),M=i(we,ve);var Ve=()=>{},he=new Uint8Array(0),j=i(()=>he,Ve);var N=t=>t===void 0?e=>a([u.enc(e.length),e]):e=>e.length===t?e:e.slice(0,t),P=t=>s(e=>{let n=t===void 0?u.dec(e):t!==1/0?t:e.byteLength-e.i,o=new Uint8Array(e.buffer.slice(e.i,e.i+n));return e.i+=n,o}),U=t=>i(N(t),P(t));U.enc=N;U.dec=P;var Y=(t,e)=>{let n=Object.keys(t),o=new Map(e?.map((c,d)=>[n[d],c])??n.map((c,d)=>[c,d])),r=c=>o.get(c);return({tag:c,value:d})=>a([m.enc(r(c)),t[c](d)])},F=(t,e)=>{let n=Object.keys(t),o=new Map(e?.map((r,c)=>[r,n[c]])??n.map((r,c)=>[c,r]));return s(r=>{let c=m.dec(r),d=o.get(c),f=t[d];return{tag:d,value:f(r)}})},C=(t,...e)=>i(Y(g(t,([n])=>n),...e),F(g(t,([,n])=>n),...e));C.enc=Y;C.dec=F;var H=t=>s(e=>{let n=m.dec(e);if(n!==0)return t===D[1]?n===1:t(e)}),W=t=>e=>{let n=new Uint8Array(1);return e===void 0?(n[0]=0,n):(n[0]=1,t===D[0]?(n[0]=e?1:2,n):a([n,t(e)]))},b=t=>i(W(t[0]),H(t[1]));b.enc=W;b.dec=H;var G=(t,e)=>s(n=>{let o=m[1](n)===0,c=(o?t:e)(n);return{success:o,value:c}}),X=(t,e)=>({success:n,value:o})=>a([m[0](n?0:1),(n?t:e)(o)]),k=(t,e)=>i(X(t[0],e[0]),G(t[1],e[1]));k.dec=G;k.enc=X;var $=(...t)=>s(e=>t.map(n=>n(e))),q=(...t)=>e=>a(e.map((n,o)=>t[o](n))),y=(...t)=>i(q(...t.map(([e])=>e)),$(...t.map(([,e])=>e)));y.enc=q;y.dec=$;var J=t=>{let e=Object.keys(t);return I(y.enc(...Object.values(t)),n=>e.map(o=>n[o]))},Q=t=>{let e=Object.keys(t);return A(y.dec(...Object.values(t)),n=>Object.fromEntries(n.map((o,r)=>[e[r],o])))},B=t=>i(J(g(t,e=>e[0])),Q(g(t,e=>e[1])));B.enc=J;B.dec=Q;var Z=(t,e)=>e>=0?n=>a(n.map(t)):n=>a([u.enc(n.length),a(n.map(t))]),z=(t,e)=>s(n=>{let o=e>=0?e:u.dec(n),r=new Array(o);for(let c=0;c<o;c++)r[c]=t(n);return r}),w=(t,e)=>i(Z(t[0],e),z(t[1],e));w.enc=Z;w.dec=z;
//# sourceMappingURL=scale-ts.cjs.production.min.js.map

@@ -59,3 +59,3 @@ var __defProp = Object.defineProperty;

// src/internal/mergeUint8.ts
var mergeUint8 = (...inputs) => {
var mergeUint8 = (inputs) => {
const len = inputs.length;

@@ -231,3 +231,3 @@ let totalLen = 0;

smValue && buffers.push(u8[0](smValue));
const result = mergeUint8(...buffers);
const result = mergeUint8(buffers);
result[0] = result.length - 5 << 2 | 3;

@@ -242,3 +242,3 @@ return result;

const val = textEncoder.encode(str2);
return mergeUint8(compact.enc(val.length), val);
return mergeUint8([compact.enc(val.length), val]);
};

@@ -261,3 +261,3 @@ var textDecoder = new TextDecoder();

// src/codecs/Bytes.ts
var BytesEnc = (nBytes) => nBytes === void 0 ? (bytes) => mergeUint8(compact.enc(bytes.length), bytes) : (bytes) => bytes.length === nBytes ? bytes : bytes.slice(0, nBytes);
var BytesEnc = (nBytes) => nBytes === void 0 ? (bytes) => mergeUint8([compact.enc(bytes.length), bytes]) : (bytes) => bytes.length === nBytes ? bytes : bytes.slice(0, nBytes);
var BytesDec = (nBytes) => toInternalBytes((bytes) => {

@@ -278,3 +278,3 @@ const len = nBytes === void 0 ? compact.dec(bytes) : nBytes !== Infinity ? nBytes : bytes.byteLength - bytes.i;

const getKey = (key) => mappedKeys.get(key);
return ({ tag, value }) => mergeUint8(u8.enc(getKey(tag)), inner[tag](value));
return ({ tag, value }) => mergeUint8([u8.enc(getKey(tag)), inner[tag](value)]);
};

@@ -316,3 +316,3 @@ var enumDec = (inner, x) => {

}
return mergeUint8(result, inner(value));
return mergeUint8([result, inner(value)]);
};

@@ -330,3 +330,6 @@ var Option = (inner) => createCodec(OptionEnc(inner[0]), OptionDec(inner[1]));

});
var ResultEnc = (okEncoder, koEncoder) => ({ success, value }) => mergeUint8(u8[0](success ? 0 : 1), (success ? okEncoder : koEncoder)(value));
var ResultEnc = (okEncoder, koEncoder) => ({ success, value }) => mergeUint8([
u8[0](success ? 0 : 1),
(success ? okEncoder : koEncoder)(value)
]);
var Result = (okCodec, koCodec) => createCodec(ResultEnc(okCodec[0], koCodec[0]), ResultDec(okCodec[1], koCodec[1]));

@@ -338,3 +341,3 @@ Result.dec = ResultDec;

var TupleDec = (...decoders2) => toInternalBytes((bytes) => decoders2.map((decoder) => decoder(bytes)));
var TupleEnc = (...encoders) => (values) => mergeUint8(...values.map((value, idx) => encoders[idx](value)));
var TupleEnc = (...encoders) => (values) => mergeUint8(values.map((value, idx) => encoders[idx](value)));
var Tuple = (...codecs) => createCodec(TupleEnc(...codecs.map(([encoder]) => encoder)), TupleDec(...codecs.map(([, decoder]) => decoder)));

@@ -358,3 +361,3 @@ Tuple.enc = TupleEnc;

// 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), mergeUint8(value.map(inner))]);
var VectorDec = (getter, size) => toInternalBytes((bytes) => {

@@ -361,0 +364,0 @@ const nElements = size >= 0 ? size : compact.dec(bytes);

{
"version": "1.4.2",
"version": "1.4.3",
"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

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