1.0.0 • Published 10 years ago

bloody-compile v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

compile

compile is a method to perform simple replacements in JavaScript.

browser support

require

var compile = require("compile")

Examples

You can pass :

Arguments

If arguments.length exceeds 2, arguments are used as primary keys.

compile("{{0}} - {{1}} - {{2}}", "foo", "bar", "baz") 
/* -> */ "foo - bar - baz"

Arrays

compile("{{0}} - {{1}} - {{2}}", ["foo", "bar", "baz"]) 
/* -> */ "foo - bar - baz"

Strings

compile("this is {{*}}", "foo") 
/* -> */ "this is foo"

Objects

compile("{{foo}} {{bar.baz}}!", {foo:"hello", bar:{baz:"yourself"}}) 
/* -> */ "hello yourself!"
1.0.0

10 years ago

0.1.0

10 years ago