Skip to content

bloodyowl/compile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

compile

compile is a method to perform simple replacements in JavaScript.

browser support

Build Status

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!"

About

Method to perform simple replacements in JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published