@budibase/handlebars-helpers
Version:
More than 130 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate, Verb, Ghost, gulp-handlebars, grunt-handlebars, consolidate, or any node.js/Handlebars project.
36 lines (32 loc) • 872 B
JavaScript
/**
* This code was taken directly from handlebars-helpers,
* https://github.com/helpers/handlebars-utils/blob/master/index.js#L398
*
* that was taken directly from handlebars.
* https://github.com/wycats/handlebars.js/blob/b55a120e8222785db3dc00096f6afbf91b656e8a/LICENSE
* Released under the MIT License
* Copyright (C) 2011-2016 by Yehuda Katz
*/
/**
* Returns the given value. If the value is a function it will be
* called with the current context, otherwise the value is returned.
*
* ```js
* console.log(utils.result('foo'));
* //=> 'foo'
* console.log(utils.result(function() {
* return 'foo';
* }));
* //=> 'foo'
* ```
* @param {any} `val`
* @return {any}
* @api public
*/
module.exports = function(val) {
if (typeof val === 'function') {
return val.apply(this, [].slice.call(arguments, 1));
}
return val;
};
;