简单实用的extend对象合并

/**
    * 合并对象
    * 示例:o = extend({ a: 'a' }, o);
    */
    function extend(s, t) {
        if (!s) {
            return {};
        }
        if (!s) {
            return s;
        }
        var o = {};
        for (var i in s) {
            o[i] = typeof (t[i]) == 'undefined' ? s[i] : t[i];
        }
        return o;
    }
原文地址:https://www.cnblogs.com/sntetwt/p/3305188.html