Set of functions that simply return a value. Can be used for stubs. Contains function that creates functions which return a value.
npm install return-function
Install Component:
npm install -g component
Then:
component install gamtiq/return-function
var ret = require("return-function");
...
define(["dist/return-function"], function(ret) {
...
});
<script type="text/javascript" src="dist/return-function.js"></script>
<script type="text/javascript">
var ret = returnFunction;
...
</script>
var global = ret.returnGlobal(); // window in browser
var first = ret.returnFirstArg(1, 2, 3); // 1
var second = ret.returnSecondArg(1, 2, 3); // 2
var list = ret.returnArgList(1, 2, 3); // [1, 2, 3]
var f = ret.getValueFunction("some value");
f(123); // "some value"
Empty function that does nothing and returns undefined
.
Empty function that does nothing and returns undefined
.
Return null
.
Return true
.
Return false
.
Return empty string.
Return NaN
.
Return 0
.
Return 1
.
Return {}
.
Return []
.
Return function () {}
.
Return new Date()
.
Return this
.
Return global object (window
in browser).
Return the first argument.
Return the second argument.
Return array of arguments.
Return function that returns specified value.