當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。