MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / format

Method format

ui/plugins/ui/jasmine/jasmine.js:6621–6693  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

6619 }
6620
6621 format(value) {
6622 this.ppNestLevel_++
6623 try {
6624 const customFormatResult = this.applyCustomFormatters_(value)
6625
6626 if (customFormatResult) {
6627 this.emitScalar(customFormatResult)
6628 } else if (j$.util.isUndefined(value)) {
6629 this.emitScalar("undefined")
6630 } else if (value === null) {
6631 this.emitScalar("null")
6632 } else if (value === 0 && 1 / value === -Infinity) {
6633 this.emitScalar("-0")
6634 } else if (value === j$.getGlobal()) {
6635 this.emitScalar("<global>")
6636 } else if (value.jasmineToString) {
6637 this.emitScalar(value.jasmineToString(this.pp_))
6638 } else if (j$.isString_(value)) {
6639 this.emitString(value)
6640 } else if (j$.isSpy(value)) {
6641 this.emitScalar("spy on " + value.and.identity)
6642 } else if (j$.isSpy(value.toString)) {
6643 this.emitScalar("spy on " + value.toString.and.identity)
6644 } else if (value instanceof RegExp) {
6645 this.emitScalar(value.toString())
6646 } else if (typeof value === "function") {
6647 this.emitScalar("Function")
6648 } else if (j$.isDomNode(value)) {
6649 if (value.tagName) {
6650 this.emitDomElement(value)
6651 } else {
6652 this.emitScalar("HTMLNode")
6653 }
6654 } else if (value instanceof Date) {
6655 this.emitScalar("Date(" + value + ")")
6656 } else if (j$.isSet(value)) {
6657 this.emitSet(value)
6658 } else if (j$.isMap(value)) {
6659 this.emitMap(value)
6660 } else if (j$.isTypedArray_(value)) {
6661 this.emitTypedArray(value)
6662 } else if (
6663 value.toString &&
6664 typeof value === "object" &&
6665 !j$.isArray_(value) &&
6666 hasCustomToString(value)
6667 ) {
6668 try {
6669 this.emitScalar(value.toString())
6670 } catch (e) {
6671 this.emitScalar("has-invalid-toString-method")
6672 }
6673 } else if (this.seen.includes(value)) {
6674 this.emitScalar("<circular reference: " + (j$.isArray_(value) ? "Array" : "Object") + ">")
6675 } else if (j$.isArray_(value) || j$.isA_("Object", value)) {
6676 this.seen.push(value)
6677 if (j$.isArray_(value)) {
6678 this.emitArray(value)

Callers 5

emitArrayMethod · 0.95
emitSetMethod · 0.95
emitMapMethod · 0.95
formatPropertyMethod · 0.95
ppFunction · 0.95

Calls 13

emitScalarMethod · 0.95
emitStringMethod · 0.95
emitDomElementMethod · 0.95
emitSetMethod · 0.95
emitMapMethod · 0.95
emitTypedArrayMethod · 0.95
emitArrayMethod · 0.95
emitObjectMethod · 0.95
hasCustomToStringFunction · 0.85
jasmineToStringMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected