@polkadot-api/utils
Advanced tools
Comparing version 0.0.1-c9dcf3b65010b0909ab3c66545ea0f5e7a358805.1.0 to 0.0.1-ca212d8e67d7e87a4f485a46edc7c02a032b4327.1.0
@@ -5,2 +5,8 @@ declare function toHex(bytes: Uint8Array): string; | ||
declare function mapObject<K extends string | number | symbol, I, O>(input: Record<K, I>, mapper: (i: I, k: K) => O): Record<K, O>; | ||
type StringRecord<T> = { | ||
[Sym: symbol]: never; | ||
[Num: number]: never; | ||
[Str: string]: T; | ||
}; | ||
declare const mapStringRecord: <I, O>(input: StringRecord<I>, mapper: (value: I, key: string) => O) => StringRecord<O>; | ||
@@ -11,2 +17,6 @@ declare const mergeUint8: (...inputs: Array<Uint8Array>) => Uint8Array; | ||
export { fromHex, mapObject, mergeUint8, noop, toHex }; | ||
declare class AbortError extends Error { | ||
constructor(); | ||
} | ||
export { AbortError, fromHex, mapObject, mapStringRecord, mergeUint8, noop, toHex }; |
@@ -23,4 +23,6 @@ "use strict"; | ||
__export(src_exports, { | ||
AbortError: () => AbortError, | ||
fromHex: () => fromHex, | ||
mapObject: () => mapObject, | ||
mapStringRecord: () => mapStringRecord, | ||
mergeUint8: () => mergeUint8, | ||
@@ -91,2 +93,5 @@ noop: () => noop, | ||
} | ||
var mapStringRecord = (input, mapper) => Object.fromEntries( | ||
Object.entries(input).map(([key, value]) => [key, mapper(value, key)]) | ||
); | ||
@@ -107,2 +112,10 @@ // src/mergeUint8.ts | ||
var noop = Function.prototype; | ||
// src/AbortError.ts | ||
var AbortError = class extends Error { | ||
constructor() { | ||
super("Abort Error"); | ||
this.name = "AbortError"; | ||
} | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -5,2 +5,8 @@ declare function toHex(bytes: Uint8Array): string; | ||
declare function mapObject<K extends string | number | symbol, I, O>(input: Record<K, I>, mapper: (i: I, k: K) => O): Record<K, O>; | ||
type StringRecord<T> = { | ||
[Sym: symbol]: never; | ||
[Num: number]: never; | ||
[Str: string]: T; | ||
}; | ||
declare const mapStringRecord: <I, O>(input: StringRecord<I>, mapper: (value: I, key: string) => O) => StringRecord<O>; | ||
@@ -11,2 +17,6 @@ declare const mergeUint8: (...inputs: Array<Uint8Array>) => Uint8Array; | ||
export { fromHex, mapObject, mergeUint8, noop, toHex }; | ||
declare class AbortError extends Error { | ||
constructor(); | ||
} | ||
export { AbortError, fromHex, mapObject, mapStringRecord, mergeUint8, noop, toHex }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var A=(t,n)=>{for(var r in n)s(t,r,{get:n[r],enumerable:!0})},K=(t,n,r,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of O(n))!g.call(t,o)&&o!==r&&s(t,o,{get:()=>n[o],enumerable:!(e=l(n,o))||e.enumerable});return t};var U=t=>K(s({},"__esModule",{value:!0}),t);var j={};A(j,{fromHex:()=>f,mapObject:()=>b,mergeUint8:()=>d,noop:()=>u,toHex:()=>p});module.exports=U(j);var m="0123456789abcdef";function p(t){let n=new Array(t.length+1);n[0]="0x";for(let r=0;r<t.length;){let e=t[r++];n[r]=m[e>>4]+m[e&15]}return n.join("")}var a={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 f(t){let n=t.length%2,r=(t[1]==="x"?2:0)+n,e=(t.length-r)/2+n,o=new Uint8Array(e);n&&(o[0]=0|a[t[2]]);for(let c=0;c<e;){let i=r+c*2,x=a[t[i]],y=a[t[i+1]];o[n+c++]=x<<4|y}return o}function b(t,n){return Object.fromEntries(Object.entries(t).map(([r,e])=>[r,n(e,r)]))}var d=(...t)=>{let n=t.reduce((e,o)=>e+o.byteLength,0),r=new Uint8Array(n);for(let e=0,o=0;e<t.length;e++){let c=t[e];r.set(c,o),o+=c.byteLength}return r};var u=Function.prototype; | ||
"use strict";var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var I=(r,t)=>{for(var e in t)i(r,e,{get:t[e],enumerable:!0})},j=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of A(t))!R.call(r,o)&&o!==e&&i(r,o,{get:()=>t[o],enumerable:!(n=l(t,o))||n.enumerable});return r};var E=r=>j(i({},"__esModule",{value:!0}),r);var K={};I(K,{AbortError:()=>s,fromHex:()=>d,mapObject:()=>u,mapStringRecord:()=>x,mergeUint8:()=>f,noop:()=>g,toHex:()=>b});module.exports=E(K);var p="0123456789abcdef";function b(r){let t=new Array(r.length+1);t[0]="0x";for(let e=0;e<r.length;){let n=r[e++];t[e]=p[n>>4]+p[n&15]}return t.join("")}var a={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 d(r){let t=r.length%2,e=(r[1]==="x"?2:0)+t,n=(r.length-e)/2+t,o=new Uint8Array(n);t&&(o[0]=0|a[r[2]]);for(let c=0;c<n;){let m=e+c*2,y=a[r[m]],O=a[r[m+1]];o[t+c++]=y<<4|O}return o}function u(r,t){return Object.fromEntries(Object.entries(r).map(([e,n])=>[e,t(n,e)]))}var x=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,n])=>[e,t(n,e)]));var f=(...r)=>{let t=r.reduce((n,o)=>n+o.byteLength,0),e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let c=r[n];e.set(c,o),o+=c.byteLength}return e};var g=Function.prototype;var s=class extends Error{constructor(){super("Abort Error"),this.name="AbortError"}}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@polkadot-api/utils", | ||
"version": "0.0.1-c9dcf3b65010b0909ab3c66545ea0f5e7a358805.1.0", | ||
"version": "0.0.1-ca212d8e67d7e87a4f485a46edc7c02a032b4327.1.0", | ||
"author": "Josep M Sobrepere (https://github.com/josepot)", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
25389
12
237