• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript obj.obj_create函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@utils/obj.obj_create函数的典型用法代码示例。如果您正苦于以下问题:TypeScript obj_create函数的具体用法?TypeScript obj_create怎么用?TypeScript obj_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了obj_create函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: mask_stringify

export function mask_stringify (input, opts?) {
    if (input == null)
        return '';

    if (typeof input === 'string')
        input = parser_parse(input);

    if (opts == null) {
        opts = obj_create(defaultOptions);
    } else  if (typeof opts === 'number'){
        var indent = opts;
        opts = obj_create(defaultOptions);
        opts.indent = indent;
        opts.minify = indent === 0;
    } else{
        opts = obj_extendDefaults(opts, defaultOptions);
        if (opts.indent > 0) {
            opts.minify = false;
        }
        if (opts.minify === true) {
            opts.indent = 0;
        }
    }

    return new Stream(input, opts).toString();
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:26,代码来源:stringify.ts


示例2: getMetaProp_

function getMetaProp_(Proto) {
    var meta = Proto.meta;
    if (meta == null) {
        meta = Proto.meta = obj_create(CompoProto.meta);
    }
    return meta;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:7,代码来源:compo_meta.ts


示例3: clone_

/*! Circular references are not handled */
function clone_(a) {
    if (a == null) 
        return null;
    
    if (typeof a !== 'object') 
        return a;
    
    if (is_Array(a)) {
        var imax = a.length,
            i = -1,
            arr = new Array(imax)
            ;
        while( ++i < imax ){
            arr[i] = clone_(a[i]);
        }
        return arr;
    }
    
    var object = obj_create(a),
        key, val;
    for(key in object){
        val = object[key];
        if (val == null || typeof val !== 'object') 
            continue;
        object[key] = clone_(val);
    }
    return object;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:29,代码来源:compo_inherit.ts


示例4: CompoBase

 return function CompoBase(node, model, ctx, container, ctr) {
     if (Ctor != null) {
         var overriden = Ctor.call(this, node, model, ctx, container, ctr);
         if (overriden != null) return overriden;
     }
     if (hasBaseAlready === true) {
         return;
     }
     if (this.compos != null) {
         this.compos = obj_create(this.compos);
     }
     if (this.pipes != null) {
         Pipes.addController(this);
     }
     if (this.attr != null) {
         this.attr = obj_create(this.attr);
     }
     if (this.scope != null) {
         this.scope = obj_create(this.scope);
     }
 };
开发者ID:atmajs,项目名称:MaskJS,代码行数:21,代码来源:compo_create.ts


示例5: initialize

	function initialize(deco) {
		if (is_Function(deco)) {
			return new deco();
		}
		// is object
		var self = obj_create(deco);
		if (deco.hasOwnProperty('constructor')) {
			var x = deco.constructor.call(self);
			if (x != null)
				return x;
		}
		return self;
	}
开发者ID:atmajs,项目名称:MaskJS,代码行数:13,代码来源:utils.ts


示例6: jmask_clone

export function jmask_clone (node, parent){
		var clone = obj_create(node);
	
		var attr = node.attr;
		if (attr != null){
			clone.attr = obj_create(attr);
		}
	
		var nodes = node.nodes;
		if (nodes != null){
			if (is_ArrayLike(nodes) === false) {
				clone.nodes = [ jmask_clone(nodes, clone) ];
			}
			else {
				clone.nodes = [];
				var imax = nodes.length,
					i = 0;
				for(; i< imax; i++){
					clone.nodes[i] = jmask_clone(nodes[i], clone);
				}
			}
		}
		return clone;
	};
开发者ID:atmajs,项目名称:MaskJS,代码行数:24,代码来源:utils.ts


示例7: builder_setCompoAttributes

export function builder_setCompoAttributes(compo, node, model, ctx, container) {
    let ownAttr = compo.attr;
    let attr = node.attr;
    if (attr == null) {
        attr = {};
    } else {
        attr = obj_create(attr);
        for (var key in attr) {
            var fn = attr[key];
            if (typeof fn === 'function') {
                attr[key] = fn('compo-attr', model, ctx, container, compo, key);
            }
        }
    }
    compo.attr = attr;

    if (compo.meta != null) {
        if (compo.meta.readAttributes != null) {
            compo.meta.readAttributes(compo, attr, model, container);
        }
        if (compo.meta.readProperties != null) {
            compo.meta.readProperties(compo, attr, model, container);
        }
    }

    for (var key in ownAttr) {
        var current = attr[key],
            val = null;

        if (current == null || key === 'class') {
            var x = ownAttr[key];

            val = is_Function(x)
                ? x('compo-attr', model, ctx, container, compo, key)
                : x;
        }
        if (key === 'class') {
            attr[key] = current == null ? val : current + ' ' + val;
            continue;
        }
        if (current != null) {
            continue;
        }
        attr[key] = val;
    }
    return attr;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:47,代码来源:util.ts


示例8: attr_extend

export function attr_extend  (a, b) {
		if (a == null) {
			return b == null
				? {}
				: obj_create(b);
		}

		if (b == null)
			return a;

		var key;
		for(key in b) {
			if ('class' === key && typeof a[key] === 'string') {
				a[key] += ' ' + b[key];
				continue;
			}
			a[key] = b[key];
		}
		return a;
	};
开发者ID:atmajs,项目名称:MaskJS,代码行数:20,代码来源:attr.ts



注:本文中的@utils/obj.obj_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript obj.obj_extend函数代码示例发布时间:2022-05-28
下一篇:
TypeScript is.is_String函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap