web-audio-test-api
Version:
Web Audio API test library for CI
37 lines (28 loc) • 936 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toS;
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
function toS(value) {
if (value === null || typeof value === "undefined") {
return String(value);
}
var type = typeof value === "undefined" ? "undefined" : _typeof(value);
if (type === "number" || type === "boolean") {
return String(value);
}
if (type === "string") {
return "'" + value + "'";
}
if (Array.isArray(value)) {
return "[ " + value.map(toS).join(", ") + " ]";
}
if (value.constructor === ({}).constructor) {
return "{ " + Object.keys(value).map(function (key) {
return key + ": " + toS(value[key]);
}).join(", ") + "}";
}
var name = value.constructor.name || Object.prototype.toString.call(value).slice(8, -1);
return "a " + name;
}