本文整理匯總了TypeScript中@utils/is.is_Object函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript is_Object函數的具體用法?TypeScript is_Object怎麽用?TypeScript is_Object使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_Object函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: mask_config
export function mask_config (a?, b?, c?) {
var args = arguments,
length = args.length
if (length === 0) {
return __cfg;
}
if (length === 1) {
let x = args[0]
if (is_Object(x)) {
obj_extend(__cfg, x);
listeners_emit('config', x);
return;
}
if (is_String(x)) {
return obj_getProperty(__cfg, x);
}
}
if (length === 2) {
var prop = args[0];
if (obj_hasProperty(__cfg, prop) === false) {
log_warn('Unknown configuration property', prop);
}
let x = {};
obj_setProperty(x , prop, args[1]);
obj_setProperty(__cfg, prop, args[1]);
listeners_emit('config', x);
return;
}
}
示例2: 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;
}
示例3: u_setOption
export function u_setOption (options, key, val) {
if (key === 'base' || key === 'nsBase') {
var path = path_normalize(val);
if (path[path.length - 1] !== '/') {
path += '/';
}
// Do not resolve root, as it will be resolved by base later
// @NextIteration: remove also path_resolveRoot, use instead resolveCurrent
// if (path[0] === '/') {
// path = path_combine(path_resolveRoot(), path);
// }
options[key] = path;
return this;
}
var current = obj_getProperty(options, key);
if (is_Object(current) && is_Object(val)) {
obj_extend(current, val);
return this;
}
obj_setProperty(options, key, val);
};
示例4: m_cfg
export function m_cfg(mix, val){
if (arguments.length === 1) {
if (is_String(mix)) {
return obj_getProperty(_opts, mix);
}
if (is_Object(mix)) {
for (var key in mix) {
u_setOption(_opts, key, mix[key]);
}
}
return this;
}
u_setOption(_opts, mix, val);
return this;
};
示例5: _wrapper_CompoBuilder
export function _wrapper_CompoBuilder (decoNode, deco, builderFn) {
let beforeRender, afterRender, decoCtx;
if (is_Function(deco)) {
beforeRender = deco;
} else if (is_Object(deco)) {
beforeRender = deco.beforeRender;
afterRender = deco.afterRender;
decoCtx = deco;
}
if (beforeRender || afterRender) {
return create(decoCtx, beforeRender, afterRender, builderFn);
}
error_withNode('Invalid node decorator', decoNode);
};
示例6: mask_run
export function mask_run (){
if (_state === 0) {
_state = _state_All
}
var args = _Array_slice.call(arguments),
model, ctx, el, Ctor;
var imax = args.length,
i = -1,
mix;
while ( ++i < imax ) {
mix = args[i];
if (mix instanceof Node) {
el = mix;
continue;
}
if (is_Function(mix)) {
Ctor = mix;
continue;
}
if (is_Object(mix)) {
if (model == null) {
model = mix;
continue;
}
ctx = mix;
}
}
if (el == null)
el = document.body;
if (Ctor == null)
Ctor = Compo;
if (model == null) {
model = {};
}
var ctr = new Ctor(null, model, ctx, el);
return _run(model, ctx, el, ctr);
};
示例7: ani_updateAttr
export function ani_updateAttr(compo, key, prop, val, meta) {
var transition = compo.attr[key + '-transition'];
if (transition == null && is_Object(meta)) {
transition = meta.transition;
}
if (transition == null) {
compo.attr[key] = val;
if (prop != null) {
compo[prop] = val;
}
_refresh(compo);
return;
}
var tweens = compo.__tweens;
if (tweens == null) {
tweens = compo.__tweens = new TweenManager(compo);
}
var start = compo[prop];
var end = val;
tweens.start(key, prop, start, end, transition);
};
示例8: fn_fromModel
function fn_fromModel(model, prop) {
if (is_Object(model) === false) {
return null;
}
var Validate = model.Validate;
if (Validate != null) {
var fn = null;
if (is_Function(fn = Validate)) {
return fn;
}
if (is_Function(fn = Validate[prop])) {
return fn;
}
}
var i = prop.indexOf('.');
if (i !== -1) {
return fn_fromModel(
model[prop.substring(0, i)], prop.substring(i+1)
);
}
return null;
}
示例9: compo_prototype
//.........這裏部分代碼省略.........
var x = nodes[i];
if (x == null) {
continue;
}
if (x.type === Dom.DECORATOR) {
var start = i;
i = Decorator.goToNode(nodes, i, imax);
decorators = _Array_slice.call(nodes, start, i);
x = nodes[i];
}
var name = x.tagName;
if ('function' === name) {
if (name === 'constructor') {
Proto.constructor = joinFns([Proto.constructor, x.fn]);
continue;
}
var fn = x.fn;
Proto[x.name] = fn;
if (x.decorators != null) {
var result = Decorator.wrapMethod(x.decorators, fn, Proto, x.name, model, null, owner);
if (is_Function(result)) {
Proto[x.name] = result;
}
}
if (x.flagSelf) {
selfFns = selfFns || [];
selfFns.push(x.name);
}
if (x.flagStatic) {
if (Proto.meta.statics == null) {
Proto.meta.statics = {};
}
Proto.meta.statics[x.name] = fn;
}
continue;
}
if ('slot' === name || 'event' === name) {
if ('event' === name && Proto.tagName != null) {
// bind the event later via the component
arr.push(x);
continue;
}
var type = name + 's';
var fns = Proto[type];
if (fns == null) {
fns = Proto[type] = {};
}
fns[x.name] = x.flagPrivate ? slot_privateWrap(x.fn) : x.fn;
if (x.decorators != null) {
var result = Decorator.wrapMethod(x.decorators, x.fn, fns, x.name, model, null, owner);
if (is_Function(result)) {
fns[x.name] = result;
}
}
continue;
}
if ('pipe' === name) {
custom_Tags.pipe.attach(x, Proto);
continue;
}
if ('define' === name || 'let' === name) {
var register = name === 'define'
? Define.registerGlobal
: Define.registerScoped;
register(x, model, Proto);
continue;
}
if ('var' === name) {
var obj = x.getObject(model, null, owner),
key, val;
for(key in obj) {
val = obj[key];
if (key === 'meta' || key === 'model' || key === 'attr' || key === 'compos') {
Proto[key] = obj_extend(Proto[key], val);
continue;
}
if (key === 'scope') {
if (is_Object(val)) {
Proto.scope = obj_extend(Proto.scope, val);
continue;
}
}
var scope = Proto.scope;
if (scope == null) {
Proto.scope = scope = {};
}
scope[key] = val;
Proto[key] = val;
}
continue;
}
if (decorators != null) {
arr.push.apply(arr, decorators);
}
arr.push(x);
}
return Proto;
}
示例10: define
import { is_Function, is_Object } from '@utils/is';
import { error_withNode } from '@core/util/reporters';
import {
_wrapMany,
_wrapper_NodeBuilder,
_wrapper_CompoBuilder,
_wrapper_Fn
} from './wrappers';
import { _getDecoType } from './utils';
import { _store } from './store';
import { Methods } from '../methods/exports';
export const Decorator = {
getDecoType: _getDecoType,
define(key, mix) {
if (is_Object(mix)) {
mix = class_create(mix);
mix.isFactory = true;
}
if (is_Function(mix) && mix.isFactory) {
// Wrap the function, as it could be a class, and decorator expression cann`t contain 'new' keyword.
_store[key] = function() {
return new (mix.bind.apply(
mix,
[null].concat(_Array_slice.call(arguments))
))();
};
_store[key].isFactory = true;
return;
}
_store[key] = mix;