本文整理匯總了TypeScript中@utils/obj.obj_create函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript obj_create函數的具體用法?TypeScript obj_create怎麽用?TypeScript obj_create使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了obj_create函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: mask_stringify
export function mask_stringify (input, opts?) {
if (input == null)
return '';
if (typeof input === 'string')
input = parser_parse(input);
if (opts == null) {
opts = obj_create(defaultOptions);
} else if (typeof opts === 'number'){
var indent = opts;
opts = obj_create(defaultOptions);
opts.indent = indent;
opts.minify = indent === 0;
} else{
opts = obj_extendDefaults(opts, defaultOptions);
if (opts.indent > 0) {
opts.minify = false;
}
if (opts.minify === true) {
opts.indent = 0;
}
}
return new Stream(input, opts).toString();
};
示例2: getMetaProp_
function getMetaProp_(Proto) {
var meta = Proto.meta;
if (meta == null) {
meta = Proto.meta = obj_create(CompoProto.meta);
}
return meta;
}
示例3: clone_
/*! Circular references are not handled */
function clone_(a) {
if (a == null)
return null;
if (typeof a !== 'object')
return a;
if (is_Array(a)) {
var imax = a.length,
i = -1,
arr = new Array(imax)
;
while( ++i < imax ){
arr[i] = clone_(a[i]);
}
return arr;
}
var object = obj_create(a),
key, val;
for(key in object){
val = object[key];
if (val == null || typeof val !== 'object')
continue;
object[key] = clone_(val);
}
return object;
}
示例4: CompoBase
return function CompoBase(node, model, ctx, container, ctr) {
if (Ctor != null) {
var overriden = Ctor.call(this, node, model, ctx, container, ctr);
if (overriden != null) return overriden;
}
if (hasBaseAlready === true) {
return;
}
if (this.compos != null) {
this.compos = obj_create(this.compos);
}
if (this.pipes != null) {
Pipes.addController(this);
}
if (this.attr != null) {
this.attr = obj_create(this.attr);
}
if (this.scope != null) {
this.scope = obj_create(this.scope);
}
};
示例5: initialize
function initialize(deco) {
if (is_Function(deco)) {
return new deco();
}
// is object
var self = obj_create(deco);
if (deco.hasOwnProperty('constructor')) {
var x = deco.constructor.call(self);
if (x != null)
return x;
}
return self;
}
示例6: 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;
};
示例7: builder_setCompoAttributes
export function builder_setCompoAttributes(compo, node, model, ctx, container) {
let ownAttr = compo.attr;
let attr = node.attr;
if (attr == null) {
attr = {};
} else {
attr = obj_create(attr);
for (var key in attr) {
var fn = attr[key];
if (typeof fn === 'function') {
attr[key] = fn('compo-attr', model, ctx, container, compo, key);
}
}
}
compo.attr = attr;
if (compo.meta != null) {
if (compo.meta.readAttributes != null) {
compo.meta.readAttributes(compo, attr, model, container);
}
if (compo.meta.readProperties != null) {
compo.meta.readProperties(compo, attr, model, container);
}
}
for (var key in ownAttr) {
var current = attr[key],
val = null;
if (current == null || key === 'class') {
var x = ownAttr[key];
val = is_Function(x)
? x('compo-attr', model, ctx, container, compo, key)
: x;
}
if (key === 'class') {
attr[key] = current == null ? val : current + ' ' + val;
continue;
}
if (current != null) {
continue;
}
attr[key] = val;
}
return attr;
}
示例8: attr_extend
export function attr_extend (a, b) {
if (a == null) {
return b == null
? {}
: obj_create(b);
}
if (b == null)
return a;
var key;
for(key in b) {
if ('class' === key && typeof a[key] === 'string') {
a[key] += ' ' + b[key];
continue;
}
a[key] = b[key];
}
return a;
};