Skip to main content

Module factories

Module factories 

Source

Functionsยง

array_fabric ๐Ÿ”’
Creates an ArrayLit with a spread.
create_array
create_array_expression
create_array_lit
Creates an ArrayLit from a vector of ExprOrSpread.
create_arrow_expression
Creates an arrow expression () => expr.
create_big_int_lit
Creates a Lit::BigInt from a BigInt.
create_binding_ident
Creates a BindingIdent from an Ident.
create_boolean_lit
Creates a Lit::Boolean from a boolean.
create_boolean_prop
Creates a PropOrSpread with a boolean key and value.
create_expr_or_spread
Wraps an arbitrary expression in ExprOrSpread with no spread. This is the generic counterpart to the typed expr_or_spread_*_factory helpers and eliminates the common boilerplate ExprOrSpread { spread: None, expr: Box::new(e) }.
create_ident
Creates an Ident from a string.
create_ident_call_expr
Creates a CallExpr with an identifier callee (e.g., func(...args)).
create_ident_key_value_prop
Creates a PropOrSpread with an unconditional PropName::Ident key.
create_ident_name
Creates an IdentName from a string.
create_jsx_attr
Creates a JSXAttr from a name and value.
create_jsx_attr_or_spread
Creates a JSXAttrOrSpread::JSXAttr wrapper.
create_jsx_spread_attr
Creates a JSXAttrOrSpread::SpreadElement for JSX attributes.
create_key_value_prop
Creates a PropOrSpread from a key and value.
create_key_value_prop_ident
Creates a KeyValueProp with an IdentName key.
create_member_call_expr
Creates a CallExpr with a member expression callee (e.g., obj.method(...args)).
create_nested_object_prop
create_null_lit
Creates a Lit::Null from a Null.
create_null_var_declarator
Creates a VarDeclarator initialized to null.
create_number_expr_or_spread
create_number_lit
Creates a Lit::Number from a number.
create_object_expression
Creates an Expr::Object from a vector of PropOrSpread.
create_object_lit
Creates an ObjectLit from a vector of PropOrSpread.
create_prop_from_name
Creates a PropOrSpread from an already-constructed PropName and an expression value.
create_spread_element
Creates a SpreadElement for spreading an expression.
create_spread_prop
Creates a PropOrSpread::Spread for spreading properties in an object literal.
create_spreaded_array
Creates an ArrayLit with a spread.
create_string_array_prop
create_string_expr_or_spread
Creates an ExprOrSpread with a string value.
create_string_key_value_prop
Creates a PropOrSpread with a string key and value.
create_string_lit
Creates a Lit::Str from a string.
create_string_var_declarator
Creates a VarDeclarator initialized to a string.
create_var_declarator
Creates a VarDeclarator with an identifier name and an expression initializer.
wrap_in_paren
Wraps an owned expression in a ParenExpr with DUMMY_SP span. This is commonly used when creating error contexts.
wrap_in_paren_ref
Wraps a reference to an expression in a ParenExpr with DUMMY_SP span. This clones the expression and is commonly used when creating error contexts.