本文整理汇总了TypeScript中vs/base/common/types.isString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isString函数的具体用法?TypeScript isString怎么用?TypeScript isString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isString函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
.then(null, e => {
if (isString(e) && /^Server returned/.test(e)) {
return;
}
this.emit('update-not-available');
this.emit('error', e);
})
开发者ID:1833183060,项目名称:vscode,代码行数:8,代码来源:auto-updater.win32.ts
示例2: getBooleanValueFromStringOrBoolean
export function getBooleanValueFromStringOrBoolean(value: any): boolean {
if (types.isBoolean(value)) {
return value;
} else if (types.isString(value)) {
return value.toLowerCase() === 'true';
}
return false;
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:8,代码来源:dialogHelper.ts
示例3: from
export function from(value: TaskDefinition, extensionId: string, messageCollector: ExtensionMessageCollector): Tasks.TaskDefinition | undefined {
if (!value) {
return undefined;
}
let taskType = Types.isString(value.type) ? value.type : undefined;
if (!taskType || taskType.length === 0) {
messageCollector.error(nls.localize('TaskTypeConfiguration.noType', 'The task type configuration is missing the required \'taskType\' property'));
return undefined;
}
let required: string[] = [];
if (Array.isArray(value.required)) {
for (let element of value.required) {
if (Types.isString(element)) {
required.push(element);
}
}
}
return { extensionId, taskType, required: required, properties: value.properties ? Objects.deepClone(value.properties) : {} };
}
开发者ID:,项目名称:,代码行数:19,代码来源:
示例4: Function
return value.replace(regexp, (match: string, name: string) => {
let config = this.configurationService.getConfiguration();
let newValue = new Function('_', 'try {return _.' + name + ';} catch (ex) { return "";}')(config);
if (Types.isString(newValue)) {
// Prevent infinite recursion and also support nested references (or tokens)
return newValue === originalValue ? '' : this.resolveString(newValue);
} else {
return this.resolve(newValue) + '';
}
});
开发者ID:GYGit,项目名称:vscode,代码行数:10,代码来源:configVariables.ts
示例5: Function
return value.replace(regexp, (match: string, name: string) => {
let config = this.configurationService.getConfiguration();
let newValue = new Function('_', 'try {return _.' + name + ';} catch (ex) { return "";}')(config);
if (Types.isString(newValue)) {
return newValue;
}
else {
return this.resolve(newValue) + '';
}
});
开发者ID:1Hgm,项目名称:vscode,代码行数:10,代码来源:configVariables.ts
示例6: toErrorMessage
export function toErrorMessage(error: any = null, verbose: boolean = false): string {
if (!error) {
return nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details.");
}
if (Array.isArray(error)) {
const errors: any[] = arrays.coalesce(error);
const msg = toErrorMessage(errors[0], verbose);
if (errors.length > 1) {
return nls.localize('error.moreErrors', "{0} ({1} errors in total)", msg, errors.length);
}
return msg;
}
if (types.isString(error)) {
return error;
}
if (error.detail) {
const detail = error.detail;
if (detail.error) {
return exceptionToErrorMessage(detail.error, verbose);
}
if (detail.exception) {
return exceptionToErrorMessage(detail.exception, verbose);
}
}
if (error.stack) {
return exceptionToErrorMessage(error, verbose);
}
if (error.message) {
return error.message;
}
return nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details.");
}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:42,代码来源:errorMessage.ts
示例7: test
test('isString', () => {
assert(!types.isString(undefined));
assert(!types.isString(null));
assert(!types.isString(5));
assert(!types.isString([]));
assert(!types.isString([1, 2, '3']));
assert(!types.isString(true));
assert(!types.isString({}));
assert(!types.isString(/test/));
assert(!types.isString(new RegExp('')));
assert(!types.isString(new Date()));
assert(!types.isString(assert));
assert(!types.isString(function foo() { /**/ }));
assert(!types.isString({ foo: 'bar' }));
assert(types.isString('foo'));
});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:17,代码来源:types.test.ts
示例8: is
export function is(value: any): value is ShellConfiguration {
let candidate: ShellConfiguration = value;
return candidate && Types.isString(candidate.executable) && (candidate.args === void 0 || Types.isStringArray(candidate.args));
}
开发者ID:yuit,项目名称:vscode,代码行数:4,代码来源:taskSystem.ts
示例9: Function
return value.replace(regexp, (match: string, name: string) => {
let config = this.configurationService.getConfiguration();
let newValue = new Function('_', 'try {return _.' + name + ';} catch (ex) { return "";}')(config);
return Types.isString(newValue) ? newValue : '';
});
开发者ID:Aarushi-Ign,项目名称:vscode,代码行数:5,代码来源:configVariables.ts
示例10: is
export function is(value: any): value is ContributedTask {
let candidate: ContributedTask = value;
return candidate && candidate.defines && Types.isString(candidate.defines.type) && candidate.command !== void 0;
}
开发者ID:naturtle,项目名称:vscode,代码行数:4,代码来源:tasks.ts
注:本文中的vs/base/common/types.isString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论