UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

20 lines (15 loc) 378 B
'use strict'; /*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ // src/intHex.ts function intToHex(integer) { if (integer < 0) { throw new Error("Invalid integer as argument, must be unsigned!"); } const hex = integer.toString(16); return hex.length % 2 ? `0${hex}` : hex; } exports.intToHex = intToHex;