carbonate
🎨 colourful sprintf
Made with ❤ at @outlandish
![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)
sprintf('I do not like %s(green) and ham.', 'green eggs')
sprintf('I do not like them, %s(yellow.bold.underline).', 'Sam-I-am')
🍪 Give some colour to your sprintf strings with chalk.
✨ Written for ES2015 environments.
👉 Use your preferred bundler and transpiler as required.
Install
npm install --save carbonate
yarn add carbonate
Import
import sprintf from 'carbonate'
var sprintf = require('carbonate')
Usage
sprintf(str[, ...values]) : String
Format a string with values.
- str {String} The string to format
- [values] {Any} Values to interpolate
Returns a string.
Examples:
sprintf('I do not like %s(green) and ham.', 'green eggs')
sprintf('I do not like them, %s(yellow.bold.underline).', 'Sam-I-am')
sprintf.log(str[, ...values])
Format and console.log a string.
- str {String} The string to format
- [values] {Any} Values to interpolate
Type specifiers
All specifiers in sprintf.js
are available.
Contributing
All pull requests and issues welcome!
If you're not sure how, check out the great video tutorials on egghead.io!
License
MIT © Sam Gluck