本文整理匯總了TypeScript中@angular/core/src/facade/lang.isString函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isString函數的具體用法?TypeScript isString怎麽用?TypeScript isString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isString函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: check
public static check(control: AbstractControl): boolean {
if (isBlank(control.value) || (isString(control.value) && control.value.trim() === '')) {
return false;
}
return true;
}
示例2: transform
transform(value) {
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
}
return JsonPointer.escape(value);
}
示例3: transform
transform(value:number):any {
if (isNumber(value)) {
return new Date(value * 1000);
} else {
if (isString(value)) {
return new Date(value);
}
}
}
示例4: _normalizeOptions
_normalizeOptions() {
// modify scrollYOffset to always be a function
if (!isFunction(this._options.scrollYOffset)) {
if (isFinite(this._options.scrollYOffset)) {
// if number specified create function that returns this value
let numberOffset = parseFloat(this._options.scrollYOffset);
this.options.scrollYOffset = () => numberOffset;
} else {
// if selector or node function that returns bottom offset of this node
let el = this._options.scrollYOffset;
if (!(el instanceof Node)) {
el = this.dom.query(el);
}
if (!el) {
this._options.scrollYOffset = () => 0;
} else {
this._options.scrollYOffset = () => el.offsetTop + el.offsetHeight;
}
}
}
if (isString(this._options.disableLazySchemas)) this._options.disableLazySchemas = true;
if (isString(this._options.suppressWarnings)) this._options.suppressWarnings = true;
}
示例5: stringifyElement
export function stringifyElement(el): string {
var result = '';
if (DOM.isElementNode(el)) {
var tagName = DOM.tagName(el).toLowerCase();
// Opening tag
result += `<${tagName}`;
// Attributes in an ordered way
var attributeMap = DOM.attributeMap(el);
var keys = [];
attributeMap.forEach((v, k) => { keys.push(k); });
keys.sort();
for (let i = 0; i < keys.length; i++) {
var key = keys[i];
var attValue = attributeMap.get(key);
if (!isString(attValue)) {
result += ` ${key}`;
} else {
result += ` ${key}="${attValue}"`;
}
}
result += '>';
// Children
var children = DOM.childNodes(DOM.templateAwareRoot(el));
for (let j = 0; j < children.length; j++) {
result += stringifyElement(children[j]);
}
// Closing tag
if (!ListWrapper.contains(_singleTagWhitelist, tagName)) {
result += `</${tagName}>`;
}
} else if (DOM.isCommentNode(el)) {
result += `<!--${DOM.nodeValue(el)}-->`;
} else {
result += DOM.getText(el);
}
return result;
}