UNPKG

twreporter-react

Version:

React-Redux site for The Reporter Foundation in Taiwan

22 lines (20 loc) 464 B
/** * Safe chained function * * Will only create a new function if needed, * otherwise will pass back existing functions or null. * * @returns {function|null} */ "use strict"; function createChainedFunction() { var args = arguments; return function chainedFunction() { for (var i = 0; i < args.length; i++) { if (args[i] && args[i].apply) { args[i].apply(this, arguments); } } }; } module.exports = createChainedFunction;