UNPKG

earljs

Version:

Ergonomic, modern and type-safe assertion library

23 lines (22 loc) 662 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRepresentation = void 0; const formatString_1 = require("./formatString"); function getRepresentation(value, type, options) { if (type === 'Boolean') { return value.toString(); } else if (type === 'Number') { return value.toString(); } else if (type === 'String') { return (0, formatString_1.formatString)(value.toString(), options); } else if (type === 'RegExp') { return `${value}`; } else if (type === 'Date') { return value.toISOString(); } } exports.getRepresentation = getRepresentation;