@technobuddha/library
Version: 
A large library of useful functions
15 lines • 785 B
JavaScript
/**
 * Converts a number to a 32-bit signed integer.
 *
 * This function effectively truncates the decimal part of the number
 * and ensures the result fits within the 32-bit signed integer range.
 * @param x - The number to convert.
 * @returns The 32-bit signed integer representation of the input.
 * @group Binary
 * @category Arithmetic
 */
export function int32(x) {
    // eslint-disable-next-line unicorn/prefer-math-trunc, no-bitwise
    return x | 0;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50MzIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW50MzIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxVQUFVLEtBQUssQ0FBQyxDQUFTO0lBQzdCLGlFQUFpRTtJQUNqRSxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDZixDQUFDIn0=