本文整理汇总了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);
},
示例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;
};
示例3: els_toggleVisibility
export function els_toggleVisibility (mix, state) {
if (mix == null) {
return;
}
if (is_ArrayLike(mix)) {
_toggleArr(mix, state);
return;
}
_toggle(mix, state);
};
示例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);
}
}
示例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;
}
示例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;
}
示例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;
},
示例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()
示例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;
};