Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-template

Package Overview
Dependencies
Maintainers
6
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-template

Generate an AST from a string template.

  • 6.3.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3M
increased by54.26%
Maintainers
6
Weekly downloads
 
Created

What is babel-template?

The babel-template npm package is a utility that allows developers to create reusable AST (Abstract Syntax Tree) templates based on a string input. It simplifies the process of generating AST nodes programmatically, which is particularly useful when working with Babel plugins that manipulate code.

What are babel-template's main functionalities?

AST Template Creation

This feature allows the creation of AST nodes from a template string. The example shows how to create a variable declaration that requires a module, with placeholders for the module name and source.

const template = require('babel-template');
const buildRequire = template(`
  var IMPORT_NAME = require(SOURCE);
`);
const ast = buildRequire({
  IMPORT_NAME: 'myModule',
  SOURCE: '"my-module"'
});

Other packages similar to babel-template

FAQs

Package last updated on 04 Dec 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