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

Function createDefaultValueCheck

test/fixtures/snapshot/typescript.js:91379–91382  ·  view source on GitHub ↗

* Creates an expression used to provide a default value if a value is `undefined` at runtime. * * @param flattenContext Options used to control flattening. * @param value The RHS value to test. * @param defaultValue The default value to use if `value` is `undefined` at runtime.

(flattenContext, value, defaultValue, location)

Source from the content-addressed store, hash-verified

91377 * @param location The location to use for source maps and comments.
91378 */
91379 function createDefaultValueCheck(flattenContext, value, defaultValue, location) {
91380 value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location);
91381 return flattenContext.context.factory.createConditionalExpression(flattenContext.context.factory.createTypeCheck(value, "undefined"), /*questionToken*/ undefined, defaultValue, /*colonToken*/ undefined, value);
91382 }
91383 /**
91384 * Creates either a PropertyAccessExpression or an ElementAccessExpression for the
91385 * right-hand side of a transformed destructuring assignment.

Callers 1

Calls 1

ensureIdentifierFunction · 0.85

Tested by

no test coverage detected