本文整理汇总了TypeScript中angular2/src/facade/lang.isString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isString函数的具体用法?TypeScript isString怎么用?TypeScript isString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isString函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: link
export function link(segment: RouteSegment, routeTree: Tree<RouteSegment>,
urlTree: Tree<UrlSegment>, change: any[]): Tree<UrlSegment> {
if (change.length === 0) return urlTree;
let startingNode;
let normalizedChange;
if (isString(change[0]) && change[0].startsWith("./")) {
normalizedChange = ["/", change[0].substring(2)].concat(change.slice(1));
startingNode = _findStartingNode(_findUrlSegment(segment, routeTree), rootNode(urlTree));
} else if (isString(change[0]) && change.length === 1 && change[0] == "/") {
normalizedChange = change;
startingNode = rootNode(urlTree);
} else if (isString(change[0]) && !change[0].startsWith("/")) {
normalizedChange = ["/"].concat(change);
startingNode = _findStartingNode(_findUrlSegment(segment, routeTree), rootNode(urlTree));
} else {
normalizedChange = ["/"].concat(change);
startingNode = rootNode(urlTree);
}
let updated = _update(startingNode, normalizedChange);
let newRoot = _constructNewTree(rootNode(urlTree), startingNode, updated);
return new Tree<UrlSegment>(newRoot);
}
开发者ID:JavaScript-Resource,项目名称:angular,代码行数:29,代码来源:link.ts
示例2: visitLiteralPrimitive
visitLiteralPrimitive(ast: LiteralPrimitive) {
if (isString(ast.value)) {
this._expression += `"${StringWrapper.replaceAll(ast.value, quoteRegExp, '\"')}"`;
} else {
this._expression += `${ast.value}`;
}
}
开发者ID:AsherBarak,项目名称:angular,代码行数:7,代码来源:unparser.ts
示例3: _update
function _update(node: TreeNode<UrlSegment>, changes: any[]): TreeNode<UrlSegment> {
let rest = changes.slice(1);
let outlet = _outlet(changes);
let segment = _segment(changes);
if (isString(segment) && segment[0] == "/") segment = segment.substring(1);
// reach the end of the tree => create new tree nodes.
if (isBlank(node)) {
let urlSegment = new UrlSegment(segment, null, outlet);
let children = rest.length === 0 ? [] : [_update(null, rest)];
return new TreeNode<UrlSegment>(urlSegment, children);
// different outlet => preserve the subtree
} else if (outlet != node.value.outlet) {
return node;
// same outlet => modify the subtree
} else {
let urlSegment = isStringMap(segment) ? new UrlSegment(null, segment, null) :
new UrlSegment(segment, null, outlet);
if (rest.length === 0) {
return new TreeNode<UrlSegment>(urlSegment, []);
}
return new TreeNode<UrlSegment>(urlSegment,
_updateMany(ListWrapper.clone(node.children), rest));
}
}
开发者ID:JavaScript-Resource,项目名称:angular,代码行数:28,代码来源:link.ts
示例4: _isValidAttributeValue
function _isValidAttributeValue(attrName, value) {
if (attrName == "role") {
return isString(value);
} else {
return isPresent(value);
}
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:property_setter_factory.ts
示例5: transform
transform(value: string, args: any[] = null): string {
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(UpperCasePipe, value);
}
return value.toUpperCase();
}
开发者ID:0oAimZo0,项目名称:Angular2Learning,代码行数:7,代码来源:uppercase_pipe.ts
示例6: transform
transform(value: string): string {
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(LowerCasePipe, value);
}
return value.toLowerCase();
}
开发者ID:844496869,项目名称:angular,代码行数:7,代码来源:lowercase_pipe.ts
示例7: _control
_control() {
if (isString(this.controlOrName)) {
return this._groupDirective.findControl(this.controlOrName);
} else {
return this.controlOrName;
}
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:directives.ts
示例8: transform
transform(value: string, args: List<any> = null): string {
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(LowerCasePipe, value);
}
return StringWrapper.toLowerCase(value);
}
开发者ID:goderbauer,项目名称:angular,代码行数:7,代码来源:lowercase_pipe.ts
示例9: _isValidAttributeValue
function _isValidAttributeValue(attrName: string, value: any): boolean {
if (attrName == "role") {
return isString(value);
} else {
return isPresent(value);
}
}
开发者ID:188799958,项目名称:angular,代码行数:7,代码来源:property_setter_factory.ts
示例10: controlGroup
set controlGroup(controlGroup) {
if (isString(controlGroup)) {
this._controlGroupName = controlGroup;
} else {
this._controlGroup = controlGroup;
}
this._updateDomValue();
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:8,代码来源:directives.ts
注:本文中的angular2/src/facade/lang.isString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论