Returns new clone of originalAst but without extra properties.
Leaves properties defined in The ESTree Spec (formerly known as Mozilla SpiderMonkey Parser API) only. Also note that extra informations (such as loc, range and raw) are eliminated too.
(note: using espurify as a default exported function is deprecated in favor of named exports aiming ESM era, and will be removed in future major releases)
Returns new clone of originalAst by customized function.
options
type
default value
object
{}
Configuration options. If not passed, default options will be used.
options.ecmaVersion
type
default value
string or number
2025
Indicates the ECMAScript version to clone. Must be either 5, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025.
options.extra
type
default value
array of string
null
List of extra properties to be left in result AST. For example, functions returned by espurify.customize({extra: ['raw']}) will preserve raw properties of Literal. Functions return by espurify.customize({extra: ['loc', 'range']}) will preserve loc and range properties of each Node.