Socket
Socket
Sign inDemoInstall

espurify

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

espurify

Clone new AST without extra properties


Version published
Weekly downloads
348K
decreased by-5.56%
Maintainers
1
Weekly downloads
 
Created

What is espurify?

The espurify npm package is used to create a deep copy of an ESTree-compliant AST (Abstract Syntax Tree) while removing extra properties that are not part of the ESTree specification. This is useful for ensuring that ASTs are standardized and can be used in various tools and libraries that expect a clean, compliant AST.

What are espurify's main functionalities?

Deep Copy of ESTree AST

This feature allows you to create a deep copy of an ESTree-compliant AST while removing any extra properties that are not part of the ESTree specification. The code sample demonstrates parsing JavaScript code into an AST using Acorn, and then purifying that AST using espurify.

const espurify = require('espurify');
const acorn = require('acorn');

const code = 'const x = 42;';
const ast = acorn.parse(code, { ecmaVersion: 2020 });
const purifiedAst = espurify(ast);

console.log(JSON.stringify(purifiedAst, null, 2));

Other packages similar to espurify

Keywords

FAQs

Package last updated on 05 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc