MCPcopy Create free account
hub / github.com/nodejs/node / ensureUseStrict

Function ensureUseStrict

test/fixtures/snapshot/typescript.js:27060–27066  ·  view source on GitHub ↗

* Ensures "use strict" directive is added * * @param statements An array of statements

(statements)

Source from the content-addressed store, hash-verified

27058 * @param statements An array of statements
27059 */
27060 function ensureUseStrict(statements) {
27061 var foundUseStrict = ts.findUseStrictPrologue(statements);
27062 if (!foundUseStrict) {
27063 return ts.setTextRange(createNodeArray(__spreadArray([createUseStrictPrologue()], statements, true)), statements);
27064 }
27065 return statements;
27066 }
27067 /**
27068 * Lifts a NodeArray containing only Statement nodes to a block.
27069 *

Callers

nothing calls this directly

Calls 2

createNodeArrayFunction · 0.85
createUseStrictPrologueFunction · 0.85

Tested by

no test coverage detected