MCPcopy Create free account
hub / github.com/DanWahlin/CustomerManagerStandard / formatTemplate

Function formatTemplate

CustomerManager/Scripts/breeze.debug.js:2898–2917  ·  view source on GitHub ↗
(template, vars, ownPropertiesOnly)

Source from the content-addressed store, hash-verified

2896 // private funcs
2897
2898 function formatTemplate(template, vars, ownPropertiesOnly) {
2899 if (!vars) return template;
2900 return template.replace(/%([^%]+)%/g, function (_, key) {
2901 var valOrFn;
2902 if (ownPropertiesOnly) {
2903 valOrFn = vars.hasOwnProperty(key) ? vars[key] : '';
2904 } else {
2905 valOrFn = vars[key];
2906 }
2907 if (valOrFn != null) {
2908 if (__isFunction(valOrFn)) {
2909 return valOrFn(vars);
2910 } else {
2911 return valOrFn;
2912 }
2913 } else {
2914 return "";
2915 }
2916 });
2917 }
2918
2919 function intRangeValidatorCtor(validatorName, minValue, maxValue, context) {
2920 var templateExists = (context && context.messageTemplate) || ctor.messageTemplates[validatorName];

Callers 1

breeze.debug.jsFile · 0.85

Calls 1

__isFunctionFunction · 0.85

Tested by

no test coverage detected