mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 20:21:01 +00:00
1 line
4.9 KiB
Plaintext
1 line
4.9 KiB
Plaintext
{"dependencies":[{"name":"./addPrefix.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":46,"index":46}}],"key":"99+0EiIo0OWQMYqaF8IQ9rZpfCQ=","exportNames":["*"],"imports":1}},{"name":"./stripPrefix.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":2,"column":0,"index":47},"end":{"line":2,"column":50,"index":97}}],"key":"5z2nEFowA0/wBFZfE5+Cv/x1ONs=","exportNames":["*"],"imports":1}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n \"use strict\";\n\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n exports.hexFixLength = hexFixLength;\n var _addPrefixJs = require(_dependencyMap[0], \"./addPrefix.js\");\n var _stripPrefixJs = require(_dependencyMap[1], \"./stripPrefix.js\");\n /**\n * @name hexFixLength\n * @summary Shifts a hex string to a specific bitLength\n * @description\n * Returns a `0x` prefixed string with the specified number of bits contained in the return value. (If bitLength is -1, length checking is not done). Values with more bits are trimmed to the specified length. Input values with less bits are returned as-is by default. When `withPadding` is set, shorter values are padded with `0`.\n * @example\n * <BR>\n *\n * ```javascript\n * import { hexFixLength } from '@polkadot/util';\n *\n * console.log('fixed', hexFixLength('0x12', 16)); // => 0x12\n * console.log('fixed', hexFixLength('0x12', 16, true)); // => 0x0012\n * console.log('fixed', hexFixLength('0x0012', 8)); // => 0x12\n * ```\n */\n function hexFixLength(value, bitLength = -1, withPadding = false) {\n const strLength = Math.ceil(bitLength / 4);\n const hexLength = strLength + 2;\n return (0, _addPrefixJs.hexAddPrefix)(bitLength === -1 || value.length === hexLength || !withPadding && value.length < hexLength ? (0, _stripPrefixJs.hexStripPrefix)(value) : value.length > hexLength ? (0, _stripPrefixJs.hexStripPrefix)(value).slice(-1 * strLength) : `${'0'.repeat(strLength)}${(0, _stripPrefixJs.hexStripPrefix)(value)}`.slice(-1 * strLength));\n }\n});","lineCount":31,"map":[[7,2,19,0,"exports"],[7,9,19,0],[7,10,19,0,"hexFixLength"],[7,22,19,0],[7,25,19,0,"hexFixLength"],[7,37,19,0],[8,2,1,0],[8,6,1,0,"_addPrefixJs"],[8,18,1,0],[8,21,1,0,"require"],[8,28,1,0],[8,29,1,0,"_dependencyMap"],[8,43,1,0],[9,2,2,0],[9,6,2,0,"_stripPrefixJs"],[9,20,2,0],[9,23,2,0,"require"],[9,30,2,0],[9,31,2,0,"_dependencyMap"],[9,45,2,0],[10,2,3,0],[11,0,4,0],[12,0,5,0],[13,0,6,0],[14,0,7,0],[15,0,8,0],[16,0,9,0],[17,0,10,0],[18,0,11,0],[19,0,12,0],[20,0,13,0],[21,0,14,0],[22,0,15,0],[23,0,16,0],[24,0,17,0],[25,0,18,0],[26,2,19,7],[26,11,19,16,"hexFixLength"],[26,23,19,28,"hexFixLength"],[26,24,19,29,"value"],[26,29,19,34],[26,31,19,36,"bitLength"],[26,40,19,45],[26,43,19,48],[26,44,19,49],[26,45,19,50],[26,47,19,52,"withPadding"],[26,58,19,63],[26,61,19,66],[26,66,19,71],[26,68,19,73],[27,4,20,4],[27,10,20,10,"strLength"],[27,19,20,19],[27,22,20,22,"Math"],[27,26,20,26],[27,27,20,27,"ceil"],[27,31,20,31],[27,32,20,32,"bitLength"],[27,41,20,41],[27,44,20,44],[27,45,20,45],[27,46,20,46],[28,4,21,4],[28,10,21,10,"hexLength"],[28,19,21,19],[28,22,21,22,"strLength"],[28,31,21,31],[28,34,21,34],[28,35,21,35],[29,4,22,4],[29,11,22,11],[29,15,22,11,"hexAddPrefix"],[29,27,22,23],[29,28,22,23,"hexAddPrefix"],[29,40,22,23],[29,42,22,25,"bitLength"],[29,51,22,34],[29,56,22,39],[29,57,22,40],[29,58,22,41],[29,62,22,45,"value"],[29,67,22,50],[29,68,22,51,"length"],[29,74,22,57],[29,79,22,62,"hexLength"],[29,88,22,71],[29,92,22,76],[29,93,22,77,"withPadding"],[29,104,22,88],[29,108,22,92,"value"],[29,113,22,97],[29,114,22,98,"length"],[29,120,22,104],[29,123,22,107,"hexLength"],[29,132,22,117],[29,135,23,10],[29,139,23,10,"hexStripPrefix"],[29,153,23,24],[29,154,23,24,"hexStripPrefix"],[29,168,23,24],[29,170,23,25,"value"],[29,175,23,30],[29,176,23,31],[29,179,24,11,"value"],[29,184,24,16],[29,185,24,17,"length"],[29,191,24,23],[29,194,24,26,"hexLength"],[29,203,24,35],[29,206,25,14],[29,210,25,14,"hexStripPrefix"],[29,224,25,28],[29,225,25,28,"hexStripPrefix"],[29,239,25,28],[29,241,25,29,"value"],[29,246,25,34],[29,247,25,35],[29,248,25,36,"slice"],[29,253,25,41],[29,254,25,42],[29,255,25,43],[29,256,25,44],[29,259,25,47,"strLength"],[29,268,25,56],[29,269,25,57],[29,272,26,14],[29,275,26,17],[29,278,26,20],[29,279,26,21,"repeat"],[29,285,26,27],[29,286,26,28,"strLength"],[29,295,26,37],[29,296,26,38],[29,299,26,41],[29,303,26,41,"hexStripPrefix"],[29,317,26,55],[29,318,26,55,"hexStripPrefix"],[29,332,26,55],[29,334,26,56,"value"],[29,339,26,61],[29,340,26,62],[29,342,26,64],[29,343,26,65,"slice"],[29,348,26,70],[29,349,26,71],[29,350,26,72],[29,351,26,73],[29,354,26,76,"strLength"],[29,363,26,85],[29,364,26,86],[29,365,26,87],[30,2,27,0],[31,0,27,1],[31,3]],"functionMap":{"names":["<global>","hexFixLength"],"mappings":"AAA;OCkB;CDQ"},"hasCjsExports":false},"type":"js/module"}]} |