Socket
Socket
Sign inDemoInstall

@polkadot-api/utils

Package Overview
Dependencies
Maintainers
2
Versions
589
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot-api/utils - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

4

dist/index.d.ts

@@ -12,2 +12,4 @@ declare function toHex(bytes: Uint8Array): string;

declare function filterObject<K extends string | number | symbol, I>(input: Record<K, I>, filterFn: (i: I, k: K) => boolean): Record<K, I>;
declare const mergeUint8: (...inputs: Array<Uint8Array>) => Uint8Array;

@@ -21,2 +23,2 @@

export { AbortError, fromHex, mapObject, mapStringRecord, mergeUint8, noop, toHex };
export { AbortError, filterObject, fromHex, mapObject, mapStringRecord, mergeUint8, noop, toHex };

@@ -24,2 +24,3 @@ "use strict";

AbortError: () => AbortError,
filterObject: () => filterObject,
fromHex: () => fromHex,

@@ -97,2 +98,9 @@ mapObject: () => mapObject,

// src/filterObject.ts
function filterObject(input, filterFn) {
return Object.fromEntries(
Object.entries(input).filter(([key, value]) => filterFn(value, key))
);
}
// src/mergeUint8.ts

@@ -99,0 +107,0 @@ var mergeUint8 = (...inputs) => {

@@ -12,2 +12,4 @@ declare function toHex(bytes: Uint8Array): string;

declare function filterObject<K extends string | number | symbol, I>(input: Record<K, I>, filterFn: (i: I, k: K) => boolean): Record<K, I>;
declare const mergeUint8: (...inputs: Array<Uint8Array>) => Uint8Array;

@@ -21,2 +23,2 @@

export { AbortError, fromHex, mapObject, mapStringRecord, mergeUint8, noop, toHex };
export { AbortError, filterObject, fromHex, mapObject, mapStringRecord, mergeUint8, noop, toHex };

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

"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"}};
"use strict";var i=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var A=(r,t)=>{for(var e in t)i(r,e,{get:t[e],enumerable:!0})},K=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of I(t))!j.call(r,o)&&o!==e&&i(r,o,{get:()=>t[o],enumerable:!(n=R(t,o))||n.enumerable});return r};var E=r=>K(i({},"__esModule",{value:!0}),r);var U={};A(U,{AbortError:()=>s,filterObject:()=>x,fromHex:()=>d,mapObject:()=>f,mapStringRecord:()=>u,mergeUint8:()=>O,noop:()=>l,toHex:()=>b});module.exports=E(U);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]],g=a[r[m+1]];o[t+c++]=y<<4|g}return o}function f(r,t){return Object.fromEntries(Object.entries(r).map(([e,n])=>[e,t(n,e)]))}var u=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,n])=>[e,t(n,e)]));function x(r,t){return Object.fromEntries(Object.entries(r).filter(([e,n])=>t(n,e)))}var O=(...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 l=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",
"version": "0.1.0",
"author": "Josep M Sobrepere (https://github.com/josepot)",

@@ -37,7 +37,2 @@ "repository": {

],
"prettier": {
"printWidth": 80,
"semi": false,
"trailingComma": "all"
},
"scripts": {

@@ -44,0 +39,0 @@ "build": "tsc --noEmit && tsup-node src/index.ts --clean --sourcemap --platform neutral --target=es2020 --format esm,cjs --dts && tsup-node src/index.ts --clean --sourcemap --platform neutral --target=es2020 --format cjs --dts --minify --out-dir dist/min",

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