当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript is.is_ArrayLike函数代码示例

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


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

示例1: function

    process: function(mix){
        if (mix.type === Dom.FRAGMENT) {

            if (mix.syntax !== 'html') {
                var count = 0, p = mix;
                while (p != null) {
                    if (p.type !== Dom.FRAGMENT) {
                        count++;
                    }
                    p = p.parent;
                }
                var stream = this.stream;
                stream.indent++;
                stream.print('<mask>\n')
                stream.indent += count;
                stream.process(mix);
                stream.print('\n');
                stream.indent--;
                stream.write('</mask>')
                stream.indent -= count;
                return;
            }
            mix = mix.nodes;
        }
        if (is_ArrayLike(mix)) {
            var imax = mix.length,
                i = -1;
            while ( ++i < imax ){
                this.processNode(mix[i]);
            }
            return;
        }
        this.processNode(mix);
    },
开发者ID:atmajs,项目名称:MaskJS,代码行数:34,代码来源:stringify.ts

示例2: mask_merge

export function mask_merge(a, b, owner?, opts?, stats?) {
    if (typeof a === 'string') {
        a = parser_parse(a);
    }
    if (typeof b === 'string') {
        b = parser_parse(b);
    }
    if (a == null || (is_ArrayLike(a) && a.length === 0)) {
        return b;
    }
    var placeholders = _resolvePlaceholders(b, b, new Placeholders(null, b, opts));
    var out = _merge(a, placeholders, owner);
    if (stats != null) {
        stats.placeholders = placeholders;
    }

    var extra = placeholders.$extra;
    if (extra != null && extra.length !== 0) {
        if (is_Array(out)) {
            return out.concat(extra);
        }
        return [out].concat(extra);
    }
    return out;
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:25,代码来源:merge.ts

示例3: els_toggleVisibility

export function els_toggleVisibility (mix, state) {
    if (mix == null) {
        return;
    }
    if (is_ArrayLike(mix)) {
        _toggleArr(mix, state);
        return;
    }
    _toggle(mix, state);
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:10,代码来源:utils.ts

示例4: arr_eachAny

export function arr_eachAny(mix, fn) {
    if (is_ArrayLike(mix) === false) {
        fn(mix);
        return;
    }
    var imax = mix.length,
        i = -1;
    while (++i < imax) {
        fn(mix[i], i);
    }
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:11,代码来源:array.ts

示例5: getSelfMutators

export function getSelfMutators(obj) {
    if (is_Object(obj) === false) {
        return null;
    }
    if (is_ArrayLike(obj)) {
        return MUTATORS_.Array;
    }
    if (is_Date(obj)) {
        return MUTATORS_.Date;
    }
    return null;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:12,代码来源:Mutators.ts

示例6: getValByFn

 function getValByFn(type, fn, key, model, ctx, el, ctr) {
     var result = fn(type, model, ctx, el, ctr, key);
     if (result == null) {
         return null;
     }
     if (typeof result === 'string') {
         return result;
     }
     if (is_ArrayLike(result)) {
         if (result.length === 0) {
             return null;
         }
         return result.join('');
     }
     return result;
 }
开发者ID:atmajs,项目名称:MaskJS,代码行数:16,代码来源:build_node.ts

示例7: function

	add: function(mix) {
		var i, length;

		if (typeof mix === 'string') {
			mix = parser_parse(mix);
		}

		if (is_ArrayLike(mix)) {
			for (i = 0, length = mix.length; i < length; i++) {
				this.add(mix[i]);
			}
			return this;
		}

		if (typeof mix === 'function' && mix.prototype.type != null) {
			// assume this is a controller
			mix = {
				controller: mix,
				type: Dom.COMPONENT
			};
		}

		var type = mix.type;
		if (type === Dom.FRAGMENT) {
			var nodes = mix.nodes;
			for(i = 0, length = nodes.length; i < length;) {
				this[this.length++] = nodes[i++];
			}
			return this;
		}

		if (type === Dom.CONTROLLER) {
			if (mix.nodes != null && mix.nodes.length) {
				for (i = mix.nodes.length; i !== 0;) {
					// set controller as parent, as parent is mask dom node
					mix.nodes[--i].parent = mix;
				}
			}
			if (mix.$ != null) {
				this.type = Dom.CONTROLLER;
			}
		}

		this[this.length++] = mix;
		return this;
	},
开发者ID:atmajs,项目名称:MaskJS,代码行数:46,代码来源:proto.ts

示例8: _fire

export function _fire  (ctr, slot, sender, args_, direction) {
    if (ctr == null) {
        return false;
    }
    var found = false,
        args  = args_,
        fn = ctr.slots != null && ctr.slots[slot];
        
    if (typeof fn === 'string') {
        fn = ctr[fn];
    }
    if (typeof fn === 'function') {
        found = true;
        
        var isDisabled = ctr.slots.__disabled != null && ctr.slots.__disabled[slot];
        if (isDisabled !== true) {

            var result = args == null
                ? fn.call(ctr, sender)
                : fn.apply(ctr, [ sender ].concat(args));

            if (result === false) {
                return true;
            }
            if (is_ArrayLike(result)) {
                args = result;
            }
        }
    }

    if (direction === -1 && ctr.parent != null) {
        return _fire(ctr.parent, slot, sender, args, direction) || found;
    }

    if (direction === 1 && ctr.components != null) {
        var compos = ctr.components,
            imax = compos.length,
            i = -1;
        while (++i < imax) {
            found = _fire(compos[i], slot, sender, args, direction) || found;
        }
    }
    
    return found;
} // _fire()
开发者ID:atmajs,项目名称:MaskJS,代码行数:45,代码来源:utils.ts

示例9: 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


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