MCPcopy
hub / github.com/Leaflet/Leaflet.markercluster / i

Function i

spec/expect.js:560–743  ·  view source on GitHub ↗

* Inspects an object. * * @see taken from node.js `util` module (copyright Joyent, MIT license) * @api private

(obj, showHidden, depth)

Source from the content-addressed store, hash-verified

558 */
559
560 function i (obj, showHidden, depth) {
561 var seen = [];
562
563 function stylize (str) {
564 return str;
565 };
566
567 function format (value, recurseTimes) {
568 // Provide a hook for user-specified inspect functions.
569 // Check that value is an object with an inspect function on it
570 if (value && typeof value.inspect === 'function' &&
571 // Filter out the util module, it's inspect function is special
572 value !== exports &&
573 // Also filter out any prototype objects using the circular check.
574 !(value.constructor && value.constructor.prototype === value)) {
575 return value.inspect(recurseTimes);
576 }
577
578 // Primitive types cannot have properties
579 switch (typeof value) {
580 case 'undefined':
581 return stylize('undefined', 'undefined');
582
583 case 'string':
584 var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '')
585 .replace(/'/g, "\\'")
586 .replace(/\\"/g, '"') + '\'';
587 return stylize(simple, 'string');
588
589 case 'number':
590 return stylize('' + value, 'number');
591
592 case 'boolean':
593 return stylize('' + value, 'boolean');
594 }
595 // For some reason typeof null is "object", so special case here.
596 if (value === null) {
597 return stylize('null', 'null');
598 }
599
600 if (isDOMElement(value)) {
601 return getOuterHTML(value);
602 }
603
604 // Look up the keys of the object.
605 var visible_keys = keys(value);
606 var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;
607
608 // Functions without properties can be shortcutted.
609 if (typeof value === 'function' && $keys.length === 0) {
610 if (isRegExp(value)) {
611 return stylize('' + value, 'regexp');
612 } else {
613 var name = value.name ? ': ' + value.name : '';
614 return stylize('[Function' + name + ']', 'special');
615 }
616 }
617

Callers 1

expect.jsFile · 0.85

Calls 1

formatFunction · 0.85

Tested by

no test coverage detected