UNPKG

simplex-lang

Version:

SimplEx - simple expression language

20 lines 557 B
import { unbox } from './index.js'; // eslint-disable-next-line @typescript-eslint/unbound-method const toString = Object.prototype.toString; export function castToBoolean(val) { return Boolean(unbox(val)); } export function castToString(val) { val = unbox(val); const type = typeof val; if (type === 'string') return val; if (val == null || type === 'number' || type === 'boolean' || type === 'bigint') { return String(val); } return toString.call(val); } //# sourceMappingURL=cast.js.map