b5e7f4b8b884970e1b4490514f57ea3030e88fc3
[platform/framework/web/crosswalk-tizen.git] /
1 define([
2     '../lang/toString',
3     '../object/get'
4 ], function(toString, get) {
5
6     var stache = /\{\{([^\}]+)\}\}/g; //mustache-like
7
8     /**
9      * String interpolation
10      */
11     function interpolate(template, replacements, syntax){
12         template = toString(template);
13         var replaceFn = function(match, prop){
14             return toString( get(replacements, prop) );
15         };
16         return template.replace(syntax || stache, replaceFn);
17     }
18
19     return interpolate;
20
21 });