* 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)
| 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. |
no test coverage detected