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

embedded-ts

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

embedded-ts

Embedded TypeScript.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

Embedded TS (ETS)

A port of EJS to support embedded TypeScript.

Usage

import * as ets from 'embedded-ts';

console.log(
  await ets.render(`
    <%
      let x: string
      x = "hello";
    %>
    <%= x %>
  `)
);

// Outputs: "hello"

Differences from EJS

  • For simplicity and consistency, all render functions are now asynchronous, so there is no async option. This also means that include functions now return promises, so to include another .ets file, you must use await include('path/to/ets/file').

  • Because this package depends on esbuild to transpile TypeScript code, it's suboptimal to provide client-accessible functions since that would require loading esbuild into a browser. Thus, there is no client option in ETS.

  • The with statement is now always used internally to expose provided data to the template. Thus, the _with and destructuredLocals options have been removed.

  • The strict option has been removed; all templates are now executed in the context of a strict-mode asynchronous IIFE.

  • The option to set global delimiters, opening brackets, and closing brackets through ets.delimiter = '?' has been removed. Instead, pass the delimiter to each render function or create a wrapper function.

FAQs

Package last updated on 16 Mar 2022

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