Join us to discuss the challenges, solutions and best practices for in-house JavaScript code sharing. Tuesday, 12/17 at 10am PT/1pm ET.Sign up here »

tage

1.0.0 • Public • Published

tage

js-standard-style

tage will turn your functions into template tags.

Just take a function that has a string as its first argument, then pass it into tage to get a function that works as a template tag, returning a new function.

The new function acts exactly as the old one as well, so you can use it both ways.

NOTE: This only works in environments that support template tags.

Example

var tage = require('tage')
var assert = require('assert')
 
function foo(str, arg1, arg2) {
  return str + arg1 + arg2
}
 
var tageFoo = tage(foo)
 
assert.equal(tageFoo('one', 'two', 'three'), 'onetwothree')
assert.equal(tageFoo `one` ('two', 'three'), 'onetwothree')

License

See LICENSE.txt

Install

npm i tage

DownloadsWeekly Downloads

11

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar