d3plus-common
Version:
Common functions and methods used across D3plus modules.
16 lines • 401 B
JavaScript
/**
@function constant
@desc Wraps non-function variables in a simple return function.
@param {Array|Number|Object|String} value The value to be returned from the function.
@example <caption>this</caption>
constant(42);
@example <caption>returns this</caption>
function() {
return 42;
}
*/
export default function (value) {
return function constant() {
return value;
};
}