UNPKG

@akala/core

Version:
20 lines 587 B
/** * A formatter that converts any value to a boolean * * @example * Booleanize.instance.format('truthy value') // returns true * Booleanize.instance.format(0) // returns false */ export default class Booleanize { /** Singleton instance for reusable formatter */ static instance = new Booleanize(); /** * Converts any input value to a boolean using double negation * @param a - The value to convert to boolean * @returns Boolean representation of the input value */ format(a) { return !!a; } } //# sourceMappingURL=booleanize.js.map