This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Parse JSON and render the results in a string template. | |
* | |
* @param {"http://path/to/myapi"} url | |
* JSON API data URL | |
* @param {"This is {{item1}}."} template | |
* string template for rendering results | |
* @customfunction | |
*/ | |
function JSONTEMPLATE_UMAR(url, template) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.mapUntil = function(fn, predicate) { | |
const arr = []; | |
let done = false; | |
this.forEach(el => { | |
if (done) return arr; | |
if (!predicate(el)) arr.push(fn(el)); | |
else done = true; | |
}); | |
return arr; | |
}; |