function trim(str) {
        var trimmed = str.replace(/^\s*/, '');
        return trimmed.replace(/\s*$/, '');
    }
Recurses through the properties of an object, converting all functions to
strings representing their source code. Returns a JSON-compatible object
that will work with JSON.stringify.

@param {Object} obj
@return {Object}
@api public