本文整理匯總了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;
};