MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / get_context_object

Function get_context_object

examples/js/repl.js:595–629  ·  view source on GitHub ↗
(line, pos)

Source from the content-addressed store, hash-verified

593 return s;
594 }
595 function get_context_object(line, pos) {
596 var obj, base, c;
597 if (pos <= 0 || " ~!%^&*(-+={[|:;,<>?/".indexOf(line[pos - 1]) >= 0)
598 return g;
599 if (pos >= 2 && line[pos - 1] === ".") {
600 pos--;
601 obj = {};
602 switch (c = line[pos - 1]) {
603 case '\'':
604 case '\"':
605 return "a";
606 case ']':
607 return [];
608 case '}':
609 return {};
610 case '/':
611 return / /;
612 default:
613 if (is_word(c)) {
614 base = get_context_word(line, pos);
615 if (["true", "false", "null", "this"].includes(base) || !isNaN(+base))
616 return eval(base);
617 obj = get_context_object(line, pos - base.length);
618 if (obj === null || obj === void 0)
619 return obj;
620 if (obj === g && obj[base] === void 0)
621 return eval(base);
622 else
623 return obj[base];
624 }
625 return {};
626 }
627 }
628 return void 0;
629 }
630
631 function get_completions(line, pos) {
632 var s, obj, ctx_obj, r, i, j, paren;

Callers 1

get_completionsFunction · 0.85

Calls 2

is_wordFunction · 0.85
get_context_wordFunction · 0.85

Tested by

no test coverage detected