UNPKG

hkt-toolbelt

Version:

Functional and composable type utilities

18 lines (17 loc) 442 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromHex = void 0; /** * Given a hexadecimal string, return the corresponding decimal number. * * @param {string} x - The hexadecimal string to convert. * * @example * ```ts * import { NaturalNumber } from "hkt-toolbelt"; * * const result = NaturalNumber.fromHex('fff') * // ^? 4095 * ``` */ exports.fromHex = ((x) => Number.parseInt(x, 16));