本文整理汇总了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);
}
示例2: visitLiteralPrimitive
visitLiteralPrimitive(ast: LiteralPrimitive) {
if (isString(ast.value)) {
this._expression += `"${StringWrapper.replaceAll(ast.value, quoteRegExp, '\"')}"`;
} else {
this._expression += `${ast.value}`;
}
}
示例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));
}
}
示例4: _isValidAttributeValue
function _isValidAttributeValue(attrName, value) {
if (attrName == "role") {
return isString(value);
} else {
return isPresent(value);
}
}
示例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();
}
示例6: transform
transform(value: string): string {
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(LowerCasePipe, value);
}
return value.toLowerCase();
}
示例7: _control
_control() {
if (isString(this.controlOrName)) {
return this._groupDirective.findControl(this.controlOrName);
} else {
return this.controlOrName;
}
}
示例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);
}
示例9: _isValidAttributeValue
function _isValidAttributeValue(attrName: string, value: any): boolean {
if (attrName == "role") {
return isString(value);
} else {
return isPresent(value);
}
}
示例10: controlGroup
set controlGroup(controlGroup) {
if (isString(controlGroup)) {
this._controlGroupName = controlGroup;
} else {
this._controlGroup = controlGroup;
}
this._updateDomValue();
}