• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript types.isNumber函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/base/common/types.isNumber函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isNumber函数的具体用法?TypeScript isNumber怎么用?TypeScript isNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isNumber函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: toPath

function toPath(p: IPathWithLineAndColumn): string {
	const segments = [p.path];

	if (types.isNumber(p.line)) {
		segments.push(String(p.line));
	}

	if (types.isNumber(p.column)) {
		segments.push(String(p.column));
	}

	return segments.join(':');
}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:13,代码来源:paths.ts


示例2: toLineAndColumnPath

function toLineAndColumnPath(parsedPath: IParsedPath): string {
	const segments = [parsedPath.path];

	if (types.isNumber(parsedPath.line)) {
		segments.push(String(parsedPath.line));
	}

	if (types.isNumber(parsedPath.column)) {
		segments.push(String(parsedPath.column));
	}

	return segments.join(':');
}
开发者ID:aminroosta,项目名称:vscode,代码行数:13,代码来源:env.ts


示例3: doSetWorked

	private doSetWorked(value: number): ProgressBar {
		assert.ok(isNumber(this.totalWork), 'Total work not set');
		const totalWork = this.totalWork!;

		this.workedVal = value;
		this.workedVal = Math.min(totalWork, this.workedVal);

		if (hasClass(this.element, css_infinite)) {
			removeClass(this.element, css_infinite);
		}

		if (hasClass(this.element, css_done)) {
			removeClass(this.element, css_done);
		}

		if (!hasClass(this.element, css_active)) {
			addClass(this.element, css_active);
		}

		if (!hasClass(this.element, css_discrete)) {
			addClass(this.element, css_discrete);
		}

		this.bit.style.width = 100 * (this.workedVal / (totalWork)) + '%';

		return this;
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:27,代码来源:progressbar.ts


示例4: if

				validation: (value: string) => {
					if (!value && option.isRequired) {
						return { type: MessageType.ERROR, content: option.displayName + missingErrorMessage };
					} else if (!types.isNumber(Number(value))) {
						return { type: MessageType.ERROR, content: invalidInputMessage };
					} else {
						return null;
					}
				}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:9,代码来源:optionsDialogHelper.ts


示例5: Number

	segments.forEach(segment => {
		const segmentAsNumber = Number(segment);
		if (!types.isNumber(segmentAsNumber)) {
			path = !!path ? [path, segment].join(':') : segment; // a colon can well be part of a path (e.g. C:\...)
		} else if (line === null) {
			line = segmentAsNumber;
		} else if (column === null) {
			column = segmentAsNumber;
		}
	});
开发者ID:StateFarmIns,项目名称:vscode,代码行数:10,代码来源:paths.ts


示例6: clb

				this.statLinkIfNeeded(currentAbsolutePath, lstat, (error, stat) => {
					if (error || this.isCanceled || this.isLimitHit) {
						return clb(null);
					}

					// Directory: Follow directories
					if (stat.isDirectory()) {
						this.directoriesWalked++;

						// to really prevent loops with links we need to resolve the real path of them
						return this.realPathIfNeeded(currentAbsolutePath, lstat, (error, realpath) => {
							if (error || this.isCanceled || this.isLimitHit) {
								return clb(null);
							}

							realpath = realpath || '';
							if (this.walkedPaths[realpath]) {
								return clb(null); // escape when there are cycles (can happen with symlinks)
							}

							this.walkedPaths[realpath] = true; // remember as walked

							// Continue walking
							return readdir(currentAbsolutePath).then(children => {
								if (this.isCanceled || this.isLimitHit) {
									return clb(null);
								}

								this.doWalk(folderQuery, currentRelativePath, children, onResult, err => clb(err || null));
							}, error => {
								clb(null);
							});
						});
					}

					// File: Check for match on file pattern and include pattern
					else {
						this.filesWalked++;
						if (currentRelativePath === this.filePattern) {
							return clb(null, undefined); // ignore file if its path matches with the file pattern because checkFilePatternRelativeMatch() takes care of those
						}

						if (this.maxFilesize && types.isNumber(stat.size) && stat.size > this.maxFilesize) {
							return clb(null, undefined); // ignore file if max file size is hit
						}

						this.matchFile(onResult, { base: rootFolder.fsPath, relativePath: currentRelativePath, basename: file, size: stat.size });
					}

					// Unwind
					return clb(null, undefined);
				});
开发者ID:eamodio,项目名称:vscode,代码行数:52,代码来源:fileSearch.ts


示例7: getNumericValue

function getNumericValue(value: string, defaultValue: number, fallback: number = void 0) {
	const numericValue = parseInt(value);

	if (types.isNumber(numericValue)) {
		return numericValue;
	}

	if (value) {
		return defaultValue;
	}

	return fallback;
}
开发者ID:Ayush-Mahajan,项目名称:vscode,代码行数:13,代码来源:env.ts


示例8: rawRequest

			req = rawRequest(opts, (res: http.IncomingMessage) => {
				const followRedirects: number = isNumber(options.followRedirects) ? options.followRedirects : 3;
				if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) {
					request(assign({}, options, {
						url: res.headers['location'],
						followRedirects: followRedirects - 1
					}), token).then(c, e);
				} else {
					let stream: Stream = res;

					if (res.headers['content-encoding'] === 'gzip') {
						stream = stream.pipe(createGunzip());
					}

					c({ res, stream } as IRequestContext);
				}
			});
开发者ID:donaldpipowitch,项目名称:vscode,代码行数:17,代码来源:request.ts


示例9: rawRequest

			req = rawRequest(opts, (res: http.ClientResponse) => {
				const followRedirects = isNumber(options.followRedirects) ? options.followRedirects : 3;
				if (res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) {
					request(assign({}, options, {
						url: res.headers['location'],
						followRedirects: followRedirects - 1
					})).done(c, e);
				} else {
					let stream: Stream = res;

					if (res.headers['content-encoding'] === 'gzip') {
						stream = stream.pipe(createGunzip());
					}

					c({ res, stream });
				}
			});
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:17,代码来源:request.ts


示例10: test

	test('isNumber', () => {
		assert(!types.isNumber(undefined));
		assert(!types.isNumber(null));
		assert(!types.isNumber('foo'));
		assert(!types.isNumber([]));
		assert(!types.isNumber([1, 2, '3']));
		assert(!types.isNumber(true));
		assert(!types.isNumber({}));
		assert(!types.isNumber(/test/));
		assert(!types.isNumber(new RegExp('')));
		assert(!types.isNumber(new Date()));
		assert(!types.isNumber(assert));
		assert(!types.isNumber(function foo() { /**/ }));
		assert(!types.isNumber({ foo: 'bar' }));
		assert(!types.isNumber(parseInt('A', 10)));

		assert(types.isNumber(5));
	});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:18,代码来源:types.test.ts



注:本文中的vs/base/common/types.isNumber函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript types.isObject函数代码示例发布时间:2022-05-25
下一篇:
TypeScript types.isFunction函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap