本文整理汇总了TypeScript中@utils/is.is_String函数的典型用法代码示例。如果您正苦于以下问题:TypeScript is_String函数的具体用法?TypeScript is_String怎么用?TypeScript is_String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_String函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: selector_match
export function selector_match (node, selector, type?) {
if (node == null)
return false;
if (is_String(selector)) {
if (type == null)
type = Dom[node.compoName ? 'CONTROLLER' : 'SET'];
selector = selector_parse(selector, type);
}
var obj = selector.prop ? node[selector.prop] : node;
if (obj == null)
return false;
if (is_Function(selector.selector))
return selector.selector(obj[selector.key]);
// regexp
if (typeof selector.selector !== 'string' && selector.selector.test != null)
return selector.selector.test(obj[selector.key]);
// string | int
/* jshint eqeqeq: false */
return obj[selector.key] == selector.selector;
/* jshint eqeqeq: true */
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:27,代码来源:selector.ts
示例2: 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;
}
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:29,代码来源:config.ts
示例3: validate
function validate(fns, val, ctr) {
if (fns == null) {
return null;
}
var imax = fns.length,
i = -1,
error, fn;
while ( ++i < imax ){
fn = fns[i];
if (fn == null) {
continue;
}
error = fn(val, ctr);
if (error != null) {
if (is_String(error)) {
return {
message: error,
actual: val
};
}
if (error.actual == null) {
error.actual = val;
}
return error;
}
}
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:27,代码来源:ValidatorProvider.ts
示例4: getTemplateProp_
function getTemplateProp_(compo) {
var template = compo.template;
if (template == null) {
var attr = compo.attr;
if (attr == null) return null;
template = attr.template;
if (template == null) return null;
delete compo.attr.template;
}
if (typeof template === 'object') return template;
if (is_String(template)) {
if (template.charCodeAt(0) === 35 && /^#[\w\d_-]+$/.test(template)) {
// #
var node = document.getElementById(template.substring(1));
if (node == null) {
log_warn('Template not found by id:', template);
return null;
}
template = node.innerHTML;
}
return parser_parse(template);
}
log_warn('Invalid template', typeof template);
return null;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:28,代码来源:compo.ts
示例5: function
return function(val, ctr){
var mix = fn(val, ctr);
if (mix == null || mix === true) {
return null;
}
if (mix === false) {
return message || ('Check failed: `' + name + '`');
}
if (is_String(mix) && mix.length !== 0) {
return mix;
}
return null;
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:13,代码来源:ValidatorProvider.ts
示例6: 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;
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:15,代码来源:config.ts
示例7: reporter_getNodeStack
export function reporter_getNodeStack(node) {
var stack = [node];
var parent = node.parent;
while (parent != null) {
stack.unshift(parent);
parent = parent.parent;
}
var str = '';
var root = stack[0];
if (root !== node && is_String(root.source) && node.sourceIndex > -1) {
str += error_formatSource(root.source, node.sourceIndex, root.filename) + '\n';
}
str += ' at ' + stack.map(function(x) { return x.tagName || x.compoName;}).join(' > ');
return str;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:16,代码来源:reporters.ts
示例8: css_ensureScopedStyles
export function css_ensureScopedStyles (str: string, node, el) {
var attr = node.attr;
if (attr.scoped == null && attr[KEY] == null) {
return str;
}
if (is_String(str) === false) {
error_withNode('Scoped style can`t have interpolations', node);
return str;
}
// Remove `scoped` attribute to exclude supported browsers.
// Redefine custom attribute to use same template later
attr.scoped = null;
attr[KEY] = 1;
var id = getScopeIdentity(node, el);
var str_ = str;
str_ = transformScopedStyles(str_, id);
str_ = transformHostCss(str_, id);
return str_;
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:19,代码来源:css.ts
示例9: function
processNode: function(node) {
var stream = this.stream;
if (is_Function(node.stringify)) {
var str = node.stringify(stream);
if (str != null) {
stream.print('<mask>');
stream.write(str);
stream.print('</mask>');
}
return;
}
if (is_String(node.content)) {
stream.print(node.content);
return;
}
if (is_Function(node.content)){
stream.print(node.content());
return;
}
if (node.type === Dom.FRAGMENT) {
this.process(node);
return;
}
stream.print('<' + node.tagName);
this.processAttr(node);
if (isEmpty(node)) {
if (html_isVoid(node)) {
stream.print('>');
return;
}
if (html_isSemiVoid(node)) {
stream.print('/>');
return;
}
stream.print('></' + node.tagName + '>');
return;
}
stream.print('>');
this.process(node.nodes);
stream.print('</' + node.tagName + '>');
},
开发者ID:atmajs,项目名称:MaskJS,代码行数:43,代码来源:stringify.ts
注:本文中的@utils/is.is_String函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论