chain = function() {
            // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358
            var lastResult,
                args = new Array(arguments.length);

            for (var i = 0, l = arguments.length; i < l; i++) {
                args[i] = arguments[i];
            }

            for (i = 0; i < funcs.length; i += 1) {
                var result = funcs[i].apply(lastResult, args);

                if (typeof result !== 'undefined') {
                    lastResult = result;
                }
            }

            return lastResult;
        }
Takes _n_ functions as arguments and returns a new function that calls them in order.
The arguments applied when calling the new function will also be applied to every function passed.
The value of `this` refers to the last value returned in the chain that was not `undefined`.
Therefore if a passed function does not return a value, the previously returned value is maintained.
After all passed functions have been called the new function returns the last returned value (if any).
If any of the passed functions are a chain, then the chain will be flattened.
@method chain
@param ...funcs {function} The functions to chain.
@return {function} A new function that calls the passed functions in order.