Closed codehag closed 4 months ago
One of the examples has the following:
const InstantExtractor = { [Symbol.customMatcher]: value => value instanceof Temporal.Instant ? [value] : value instanceof Date ? [Temporal.Instant.fromEpochMilliseconds(value.getTime())] : typeof value === "string" ? [Temporal.Instant.from(value)] : false };
This ternary statement is quite hard to read. Can we switch this for a clearer, longer version using if statements?
similar to elsewhere in the readme:
function toInstant(value) { if (value instanceof Temporal.Instant) { return value; } else if (value instanceof Date) { return Temporal.Instant.fromEpochMilliseconds(+value); } else if (typeof value === "string") { return Temporal.Instant.from(value); } else { throw new TypeError(); } }
One of the examples has the following:
This ternary statement is quite hard to read. Can we switch this for a clearer, longer version using if statements?
similar to elsewhere in the readme: