bloody-compile

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i bloody-compile

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bloodyowl