Skip to content

Instantly share code, notes, and snippets.

View fedeghe's full-sized avatar
❤️‍🔥
you

Federico Corrado Ghedina Krepo fedeghe

❤️‍🔥
you
View GitHub Profile
(function (ns){
// this is due, to test all implications see
// http://www.jmvc.org/test_strict
"use strict";
var debugActive = false;
/**
* Creates a namespace
* @param {String} str dot or slash separated path for the namespace
@fedeghe
fedeghe / replaceall.js
Last active January 31, 2023 08:04
A useful function to give values to a template full of placeholders
/**
* [ description]
* @param {string} tpl the template
* @param {literal|function} obj a literal for substitution or a function that will
* return the substitution given as parameter a string
* @param {string} start optional- the opening placeholder delimitator (%)
* @param {string} end optional- the closing placeholder delimitator (%)
* @param {string} fb optional- a fallback value in case an element is not found
* @return {string} the resulting string with replaced values
*/