UNPKG

jasmine-test-cases

Version:
40 lines (39 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.expectify = void 0; var check_1 = require("./check"); var type_1 = require("./type"); var expectify = function (args) { check_1.Check.isArray(args); return '[' + args.reduce(function (previous, current) { if (current === undefined) { current = 'undefined'; } else if (typeof current === 'function') { current = '\u0192'; } else if ((0, type_1.type)(current) === '[RegExp]') { current = '/' + current.source + '/' + current.flags; } else if ((0, type_1.type)(current) === '[Symbol]') { current = '#'; } else if ((0, type_1.type)(current) === '[Number]' && current === Infinity) { current = '\u221E'; } else if ((0, type_1.type)(current) === '[Number]' && current === -Infinity) { current = '-\u221E'; } else if ((0, type_1.type)(current) === '[Number]' && isNaN(current)) { current = 'NaN'; } else if ((0, type_1.type)(current) === '[Number]' && current === 0 && 1 / current < 0) { current = '-0'; } else { current = JSON.stringify(current); } return previous + (previous !== '' ? ', ' : '') + current; }, '') + ']'; }; exports.expectify = expectify;