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

async-tag

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-tag

Resolves template literals tag values before applying a generic tag

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.2K
increased by0.94%
Maintainers
1
Weekly downloads
 
Created
Source

async-tag

Build Status Coverage Status

Social Media Photo by Tobias Rademacher on Unsplash

Resolves template literals tag values before applying a generic tag.

import asyncTag from 'async-tag';
// or const asyncTag = require('asyncTag');
// or <script src="//unpkg.com/async-tag">

// example
const asyncRaw = asyncTag(String.raw);

// async values
asyncRaw`a${[
  1,
  [2, [Promise.resolve(3)], 4],
  [5, 6]
]}${Promise.resolve(7)}c`
  .then(result => {
    console.assert(result === 'a1,2,3,4,5,67c')
  });

// direct values
asyncRaw`a${'b'}c`
  .then(result => {
    console.assert(result === 'abc')
  });

Compatibility

This module source code is written in a way that guarantees there won't be any code bloat once transpiled, without necessarily providing worse performance than native ES6+.

Both index.js and min.js target any client/server JavaScript engine, assuming there is support, or there is a polyfill, for:

  • Array.isArray(any) to work with nested interpolations
  • Promise.all(array) to resolve all interpolations
  • Function.prototype.bind to be sure both context and template are expected

Please note this module is pretty much done so, if there are not many updates in the long term, it's because it's 100% code covered and, for what it does, it won't likely need any change in the future.

Keywords

FAQs

Package last updated on 31 Dec 2020

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