@polkadot-api/utils
Advanced tools
Comparing version 0.0.1-5f0fe49a72a058a62aaac5040bea83d67b0f32a5.1.0 to 0.0.1-5f21a32c61a607b71f74693e0a46e8f69d497381.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,2 @@ declare const mergeUint8: (...inputs: Array<Uint8Array>) => Uint8Array; | ||
export { fromHex, mapObject, mergeUint8, noop, toHex }; | ||
export { fromHex, mapObject, mapStringRecord, mergeUint8, noop, toHex }; |
@@ -25,2 +25,3 @@ "use strict"; | ||
mapObject: () => mapObject, | ||
mapStringRecord: () => mapStringRecord, | ||
mergeUint8: () => mergeUint8, | ||
@@ -91,2 +92,5 @@ noop: () => noop, | ||
} | ||
var mapStringRecord = (input, mapper) => Object.fromEntries( | ||
Object.entries(input).map(([key, value]) => [key, mapper(value, key)]) | ||
); | ||
@@ -93,0 +97,0 @@ // src/mergeUint8.ts |
@@ -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,2 @@ declare const mergeUint8: (...inputs: Array<Uint8Array>) => Uint8Array; | ||
export { fromHex, mapObject, mergeUint8, noop, toHex }; | ||
export { 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 s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var A=(t,r)=>{for(var e in r)s(t,e,{get:r[e],enumerable:!0})},I=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of l(r))!R.call(t,o)&&o!==e&&s(t,o,{get:()=>r[o],enumerable:!(n=x(r,o))||n.enumerable});return t};var j=t=>I(s({},"__esModule",{value:!0}),t);var K={};A(K,{fromHex:()=>d,mapObject:()=>b,mapStringRecord:()=>f,mergeUint8:()=>g,noop:()=>u,toHex:()=>p});module.exports=j(K);var m="0123456789abcdef";function p(t){let r=new Array(t.length+1);r[0]="0x";for(let e=0;e<t.length;){let n=t[e++];r[e]=m[n>>4]+m[n&15]}return r.join("")}var i={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(t){let r=t.length%2,e=(t[1]==="x"?2:0)+r,n=(t.length-e)/2+r,o=new Uint8Array(n);r&&(o[0]=0|i[t[2]]);for(let c=0;c<n;){let a=e+c*2,y=i[t[a]],O=i[t[a+1]];o[r+c++]=y<<4|O}return o}function b(t,r){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,r(n,e)]))}var f=(t,r)=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e,r(n,e)]));var g=(...t)=>{let r=t.reduce((n,o)=>n+o.byteLength,0),e=new Uint8Array(r);for(let n=0,o=0;n<t.length;n++){let c=t[n];e.set(c,o),o+=c.byteLength}return e};var u=Function.prototype; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@polkadot-api/utils", | ||
"version": "0.0.1-5f0fe49a72a058a62aaac5040bea83d67b0f32a5.1.0", | ||
"version": "0.0.1-5f21a32c61a607b71f74693e0a46e8f69d497381.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
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
23871
12
215