UNPKG

@exromany/lido-csm-sdk

Version:

[![GitHub license](https://img.shields.io/github/license/lidofinance/lido-csm-sdk?color=limegreen)](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [![Version npm](https://img.shields.io/npm/v/@lidofinance/lido-csm-sdk?label=version)](h

20 lines 687 B
export const isHexadecimalString = (input, length) => { if (typeof input !== 'string') return false; const normalizedInput = trimHexPrefix(input); const isValid = /^[0-9a-fA-F]+$/.test(normalizedInput); if (length !== undefined) { return isValid && normalizedInput.length === length; } return isValid; }; export const trimHexPrefix = (input) => { return input.startsWith('0x') ? input.slice(2) : input; }; export const toHexString = (text) => { return text.startsWith('0x') ? text : `0x${text}`; }; export const normalizeTrimHex = (hex) => { return trimHexPrefix(hex).toLowerCase(); }; //# sourceMappingURL=is-hexadecimal-string.js.map