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

ansi-template

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-template

Super-simple templating for ansi-styles

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ansi-template

A String.prototype friendly replacement for colors-tmpl

Workshopper use colors-tmpl to replace {red}-like template commands with ansi colour / formatting codes. It also uses chalk for ad-hoc terminal formatting.

var ansi = require('ansi-template')
ansi('{red}Error{/red} don\'t hold much hope for the {underline}creedence tapes{/underline}')

// will return a strin with the {foo}'s replaced with the equivelant ansi-style code

This module is intended to be a simpler, chalk friendly alternative to colors-tmpl with no String.prototype noodling.

But then I found that colors/safe as used by colors-tmpl doesn't have the same String.prototpye noodling horror. So, a timely reminder to research before adding to the pile of code. Regardless, if you want super simple colors-tmpl style templatin for crafting terminal messages from plain text without having to look at the madness that is ansi formatting codes, this'll do that.

Made possible by the clean seperation of concerns that is chalk and ansi-styles

Keywords

FAQs

Package last updated on 21 Feb 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