Newer
Older
mcms / ms-mcms / src / main / webapp / static / plugins / ms / 1.0.0 / compatible.js
StephanieGitHub on 16 Dec 2020 803 bytes first commit
/**
 * 兼容ie 重写合并js对象方法
 * 在ie浏览器中使用es6 语法"Object.assign()"合并对象报错,可以引用该js
 */

if (typeof Object.assign != 'function') {
    Object.assign = function(target) {
        'use strict';
        if (target == null) {
            throw new TypeError('Cannot convert undefined or null to object');
        }
        target = Object(target);
        for (var index = 1; index < arguments.length; index++) {
            var source = arguments[index];
            if (source != null) {
                for (var key in source) {
                    if (Object.prototype.hasOwnProperty.call(source, key)) {
                        target[key] = source[key];
                    }
                }
            }
        }
        return target;
    };
}