rich-domain
Version:
This package provide utils file and interfaces to assistant build a complex application with domain driving design
28 lines • 882 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToLong = void 0;
/**
* @description Converts a number to its "long" equivalent by multiplying it by 100.
* This is useful for denormalizing values, such as converting decimals to percentages.
*
* @param value The input value to convert. Must be a number.
*
* @returns The "long" equivalent of the input number.
* If the input is not a valid number, it returns the input as is.
*
* @example
* ```typescript
* ToLong(5); // Returns 500
* ToLong(0.25); // Returns 25
* ToLong("100"); // Returns "100" (input not a valid number)
* ```
*/
const ToLong = (value) => {
const isValid = typeof value === 'number';
if (!isValid)
return value;
return value * 100;
};
exports.ToLong = ToLong;
exports.default = exports.ToLong;
//# sourceMappingURL=to-long-number.util.js.map