Skip to content

Commit 65283ac

Browse files
committed
Clarify semantic tag normalization
1 parent 4f28f63 commit 65283ac

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/lib/semantic-tags.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import { getW3CDateString } from './w3cdate';
77
function normalizeSemanticValue(value: SemanticTagValue): SemanticTagValue {
88
if (value instanceof Date) {
99
if (!Number.isFinite(value.getTime()))
10-
throw new TypeError(`Semantic tag dates must be valid Date instances`);
10+
throw new TypeError(`Semantic tag Date values must be valid`);
1111
return getW3CDateString(value);
1212
}
1313

1414
if (Array.isArray(value)) return value.map(normalizeSemanticValue);
1515

16+
// The truthiness check excludes null, because typeof null is 'object'.
1617
if (value && typeof value === 'object') {
1718
const result: { [key: string]: SemanticTagValue } = {};
1819
for (const [key, nestedValue] of Object.entries(value))

0 commit comments

Comments
 (0)