UNPKG

@magidoc/plugin-starter-variables

Version:

A shared library that contains common Magidoc starter environment variables keys.

28 lines (26 loc) 835 B
function booleanConverter() { return { convert: (target) => { if (target === null) return null; if (target === undefined) return null; switch (typeof target) { case 'boolean': return target; case 'string': { const lowerCase = target.toLowerCase().trim(); return lowerCase === 'true' || lowerCase === 't' || lowerCase === '1'; } case 'number': return target !== 0; default: return null; } }, asString: (value) => String(value), type: (z) => z.boolean().optional(), }; } export { booleanConverter }; //# sourceMappingURL=boolean.js.map