MCPcopy Index your code
hub / github.com/nodejs/node / isObjectLiteral

Function isObjectLiteral

lib/internal/repl/utils.js:786–789  ·  view source on GitHub ↗

* Checks if some provided code represents an object literal. * This is helpful to prevent confusing repl code evaluations where * strings such as `{ a : 1 }` would get interpreted as block statements * rather than object literals. * @param {string} code the code to check * @returns {boolean} tr

(code)

Source from the content-addressed store, hash-verified

784 * @returns {boolean} true if the code represents an object literal, false otherwise
785 */
786function isObjectLiteral(code) {
787 return RegExpPrototypeExec(startsWithBraceRegExp, code) !== null &&
788 RegExpPrototypeExec(endsWithSemicolonRegExp, code) === null;
789}
790
791const kContextId = Symbol('contextId');
792

Callers 2

defaultEvalMethod · 0.85
prepareControlCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…