@polkadot-api/utils
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,36 +0,4 @@ | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
'use strict'; | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
AbortError: () => AbortError, | ||
filterObject: () => filterObject, | ||
fromHex: () => fromHex, | ||
mapObject: () => mapObject, | ||
mapStringRecord: () => mapStringRecord, | ||
mergeUint8: () => mergeUint8, | ||
noop: () => noop, | ||
toHex: () => toHex | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/hex.ts | ||
var HEX_STR = "0123456789abcdef"; | ||
const HEX_STR = "0123456789abcdef"; | ||
function toHex(bytes) { | ||
@@ -45,3 +13,3 @@ const result = new Array(bytes.length + 1); | ||
} | ||
var HEX_MAP = { | ||
const HEX_MAP = { | ||
0: 0, | ||
@@ -75,4 +43,3 @@ 1: 1, | ||
const bytes = new Uint8Array(nBytes); | ||
if (isOdd) | ||
bytes[0] = 0 | HEX_MAP[hexString[2]]; | ||
if (isOdd) bytes[0] = 0 | HEX_MAP[hexString[2]]; | ||
for (let i = 0; i < nBytes; ) { | ||
@@ -87,3 +54,2 @@ const idx = base + i * 2; | ||
// src/mapObject.ts | ||
function mapObject(input, mapper) { | ||
@@ -96,7 +62,6 @@ return Object.fromEntries( | ||
} | ||
var mapStringRecord = (input, mapper) => Object.fromEntries( | ||
const mapStringRecord = (input, mapper) => Object.fromEntries( | ||
Object.entries(input).map(([key, value]) => [key, mapper(value, key)]) | ||
); | ||
// src/filterObject.ts | ||
function filterObject(input, filterFn) { | ||
@@ -108,4 +73,3 @@ return Object.fromEntries( | ||
// src/mergeUint8.ts | ||
var mergeUint8 = (...inputs) => { | ||
const mergeUint8 = (...inputs) => { | ||
const totalLen = inputs.reduce((acc, a) => acc + a.byteLength, 0); | ||
@@ -121,7 +85,5 @@ const result = new Uint8Array(totalLen); | ||
// src/noop.ts | ||
var noop = Function.prototype; | ||
const noop = Function.prototype; | ||
// src/AbortError.ts | ||
var AbortError = class extends Error { | ||
class AbortError extends Error { | ||
constructor() { | ||
@@ -131,3 +93,12 @@ super("Abort Error"); | ||
} | ||
}; | ||
//# sourceMappingURL=index.js.map | ||
} | ||
exports.AbortError = AbortError; | ||
exports.filterObject = filterObject; | ||
exports.fromHex = fromHex; | ||
exports.mapObject = mapObject; | ||
exports.mapStringRecord = mapStringRecord; | ||
exports.mergeUint8 = mergeUint8; | ||
exports.noop = noop; | ||
exports.toHex = toHex; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@polkadot-api/utils", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Josep M Sobrepere (https://github.com/josepot)", | ||
@@ -15,12 +15,12 @@ "repository": { | ||
"production": { | ||
"import": "./dist/index.mjs", | ||
"import": "./dist/esm/index.mjs", | ||
"require": "./dist/min/index.js", | ||
"default": "./dist/index.js" | ||
}, | ||
"import": "./dist/index.mjs", | ||
"import": "./dist/esm/index.mjs", | ||
"require": "./dist/index.js", | ||
"default": "./dist/index.js" | ||
}, | ||
"module": "./dist/index.mjs", | ||
"import": "./dist/index.mjs", | ||
"module": "./dist/esm/index.mjs", | ||
"import": "./dist/esm/index.mjs", | ||
"require": "./dist/index.js", | ||
@@ -32,4 +32,4 @@ "default": "./dist/index.js" | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"browser": "./dist/index.mjs", | ||
"module": "./dist/esm/index.mjs", | ||
"browser": "./dist/esm/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
@@ -40,3 +40,3 @@ "files": [ | ||
"scripts": { | ||
"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", | ||
"build": "tsc --noEmit && rollup -c ../../rollup.config.js", | ||
"test": "echo 'no tests'", | ||
@@ -43,0 +43,0 @@ "lint": "prettier --check README.md \"src/**/*.{js,jsx,ts,tsx,json,md}\"", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20
20817
205