MCPcopy
hub / github.com/jcubic/jquery.terminal / preprocess_value

Function preprocess_value

js/jquery.terminal-src.js:7905–7946  ·  view source on GitHub ↗
(value, options)

Source from the content-addressed store, hash-verified

7903 // ---------------------------------------------------------------------
7904 var recursive_render = false;
7905 function preprocess_value(value, options) {
7906 options = options || {};
7907 if ($.terminal.Animation && value instanceof $.terminal.Animation) {
7908 value.start(self);
7909 return false;
7910 }
7911 if (is_function(settings.renderHandler)) {
7912 if (recursive_render) {
7913 return value;
7914 }
7915 return unpromise(value, function(value) {
7916 try {
7917 recursive_render = true;
7918 var ret = settings.renderHandler.call(self, value, options, self);
7919 if (ret === false) {
7920 return false;
7921 }
7922 var was_promise = is_promise(ret);
7923 if (was_promise) {
7924 return always(ret, function() {
7925 recursive_render = false;
7926 });
7927 }
7928 if (typeof ret === 'string' || is_node(ret)) {
7929 return ret;
7930 } else {
7931 return value;
7932 }
7933 } catch (e) {
7934 return [
7935 '[[;red;]' + e.message + ']',
7936 format_stack_trace(e.stack)
7937 ].join('\n');
7938 } finally {
7939 if (!was_promise) {
7940 recursive_render = false;
7941 }
7942 }
7943 });
7944 }
7945 return value;
7946 }
7947 // ---------------------------------------------------------------------
7948 // :: helper function used in render and in update
7949 // ---------------------------------------------------------------------

Callers 3

display_objectFunction · 0.70
echoFunction · 0.70

Calls 7

is_functionFunction · 0.70
unpromiseFunction · 0.70
is_promiseFunction · 0.70
alwaysFunction · 0.70
is_nodeFunction · 0.70
format_stack_traceFunction · 0.70
startMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…