zoukankan      html  css  js  c++  java
  • Extjs/js两个对象的属性进行混合

    /*
         * @param {Object} target 目标对象。 @param {Object} source 源对象。 @param {boolean}
         * deep 是否复制(继承)对象中的对象。 @returns {Object} 返回继承了source对象属性的新对象。
         */
        Mixing2Object : function ( target , source ,deep ){
            target = target || {};
            var sType = typeof source , i = 1 , options;
            if ( sType === 'undefined' || sType === 'boolean' ){
                deep = sType === 'boolean' ? source : false;
                source = target;
                target = this;
            }
            if ( typeof source !== 'object'
                && Object.prototype.toString.call( source ) !== '[object Function]' )
                source = {};
            while ( i <= 2 ){
                options = i === 1 ? target : source;
                if ( options != null ){
                    forvar name in options){
                        var src = target [name] , copy = options [name];
                        if ( target === copy )
                            continue;
                        if ( deep && copy && typeof copy === 'object' && !copy.nodeType )
                            target [name] =
                                this.extend( src || (copy.length != null ? [] : {}) , copy ,
                                  deep );
                        else if ( copy !== undefined )
                            target [name] = copy;
                    }
                }
                i++;
            }
            return target;
        }



  • 相关阅读:
    调参过程中的参数 学习率,权重衰减,冲量(learning_rate , weight_decay , momentum)
    mxnet框架样本,使用C++接口
    faster-rcnn中ROI_POOIING层的解读
    SVM公式推导笔记
    RNN的简单的推导演算公式(BPTT)
    优化器--牛顿法总结
    评估一个预测模型性能通常都有那些指标
    nautilus出现一闪而过现象
    PIL遇到问题解决
    使用神经网络来拟合函数y = x^3 +b
  • 原文地址:https://www.cnblogs.com/babyhhcsy/p/3434640.html
Copyright © 2011-2022 走看看