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

TypeScript objects.assign函数代码示例

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

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



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

示例1: globExprsToRgGlobs

	folderQueries.forEach(folderQuery => {
		const totalExcludePattern = objects.assign({}, folderQuery.excludePattern || {}, globalExclude || {});
		const result = globExprsToRgGlobs(totalExcludePattern, absoluteGlobs && folderQuery.folder, excludesToSkip);
		globArgs.push(...result.globArgs);
		if (result.siblingClauses) {
			siblingClauses = objects.assign(siblingClauses, result.siblingClauses);
		}
	});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:8,代码来源:ripgrepFileSearch.ts


示例2: xhr

export function xhr(options: IXHROptions): TPromise<IXHRResponse> {
	const agent = getProxyAgent(options.url, { proxyUrl, strictSSL });
	options = assign({}, options);
	options = assign(options, { agent, strictSSL });

	return request(options).then(result => new TPromise<IXHRResponse>((c, e, p) => {
		const res = result.res;
		let stream: Stream = res;

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

		const data: string[] = [];
		stream.on('data', c => data.push(c));
		stream.on('end', () => {
			const status = res.statusCode;

			if (options.followRedirects > 0 && (status >= 300 && status <= 303 || status === 307)) {
				let location = res.headers['location'];
				if (location) {
					let newOptions = {
						type: options.type, url: location, user: options.user, password: options.password, responseType: options.responseType, headers: options.headers,
						timeout: options.timeout, followRedirects: options.followRedirects - 1, data: options.data
					};
					xhr(newOptions).done(c, e, p);
					return;
				}
			}

			const response: IXHRResponse = {
				responseText: data.join(''),
				status,
				getResponseHeader: header => res.headers[header],
				readyState: 4
			};

			if ((status >= 200 && status < 300) || status === 1223) {
				c(response);
			} else {
				e(response);
			}
		});
	}, err => {
		let message: string;

		if (agent) {
			message = 'Unable to to connect to ' + options.url + ' through a proxy . Error: ' + err.message;
		} else {
			message = 'Unable to to connect to ' + options.url + '. Error: ' + err.message;
		}

		return TPromise.wrapError<IXHRResponse>({
			responseText: message,
			status: 404
		});
	}));
}
开发者ID:1833183060,项目名称:vscode,代码行数:58,代码来源:rawHttpService.ts


示例3: xhr

export function xhr(options: IXHROptions): TPromise<IXHRResponse> {
	let endpoint = parseUrl(options.url);
	options = assign({}, options);
	options = assign(options, { agent: getProxyAgent(endpoint) });

	return request(options).then(result => new TPromise<IXHRResponse>((c, e, p) => {
		let res = result.res;
		let data: string[] = [];
		res.on('data', c => data.push(c));
		res.on('end', () => {
			if (options.followRedirects > 0 && (res.statusCode >= 300 && res.statusCode <= 303 || res.statusCode === 307)) {
				let location = res.headers['location'];
				if (location) {
					let newOptions = {
						type: options.type, url: location, user: options.user, password: options.password, responseType: options.responseType, headers: options.headers,
						timeout: options.timeout, followRedirects: options.followRedirects - 1, data: options.data
					};
					xhr(newOptions).done(c, e, p);
					return;
				}
			}

			let response: IXHRResponse = {
				responseText: data.join(''),
				status: res.statusCode
			};

			if ((res.statusCode >= 200 && res.statusCode < 300) || res.statusCode === 1223) {
				c(response);
			} else {
				e(response);
			}
		});
	}, err => {
		let endpoint = parseUrl(options.url);
		let agent = getProxyAgent(endpoint);
		let message: string;

		if (agent) {
			message = 'Unable to to connect to ' + options.url + ' through proxy ' + getProxyURI(endpoint) + '. Error: ' + err.message;
		} else {
			message = 'Unable to to connect to ' + options.url + '. Error: ' + err.message;
		}

		return TPromise.wrapError<IXHRResponse>({
			responseText: message,
			status: 404
		});
	}));
}
开发者ID:gaoxiaojun,项目名称:vscode,代码行数:50,代码来源:rawHttpService.ts


示例4: create

	export function create(value: TaskIdentifier): KeyedTaskIdentifier {
		const hash = crypto.createHash('md5');
		hash.update(JSON.stringify(value));
		let result = { _key: hash.digest('hex'), type: value.taskType };
		Objects.assign(result, value);
		return result;
	}
开发者ID:developers23,项目名称:vscode,代码行数:7,代码来源:tasks.ts


示例5: main

export function main(args: string[]) {
	const argv = parseArgs(args);

	if (argv.help) {
		console.log(helpMessage);
	} else if (argv.version) {
		console.log(pkg.version);
	} else {
		const env = assign({}, process.env);
		delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];

		const child = spawn(process.execPath, args, {
			detached: true,
			stdio: 'ignore',
			env
		});

		if (argv.wait) {
			child.on('exit', process.exit);
			return;
		}
	}

	process.exit(0);
}
开发者ID:DanEEStar,项目名称:vscode,代码行数:25,代码来源:cli.ts


示例6: assign

	.then(userEnv => {
		assign(process.env, userEnv);

		return timebomb()
			.then(setupIPC)
			.then(ipcServer => main(ipcServer, userEnv));
	})
开发者ID:gaoxiaojun,项目名称:vscode,代码行数:7,代码来源:main.ts


示例7: main

export function main(args: string[]) {
	const argv = parseArgs(args);

	if (argv.help) {
		console.log(helpMessage);
	} else if (argv.version) {
		console.log(pkg.version);
	} else {
		const env = assign({}, process.env, {
			// this will signal Code that it was spawned from this module
			'VSCODE_CLI': '1',
			'ELECTRON_NO_ATTACH_CONSOLE': '1'
		});
		delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];

		const child = spawn(process.execPath, args, {
			detached: true,
			stdio: 'ignore',
			env
		});

		if (argv.wait) {
			child.on('exit', process.exit);
			return;
		}
	}

	process.exit(0);
}
开发者ID:Elflyy,项目名称:vscode,代码行数:29,代码来源:cli.ts


示例8: main

export function main(args: string[]): TPromise<void> {
	const argv = parseArgs(args);

	if (argv.help) {
		console.log(helpMessage);
	} else if (argv.version) {
		console.log(pkg.version);
	} else if (shouldSpawnCliProcess(argv)) {
		const mainCli = new TPromise<IMainCli>(c => require(['vs/code/node/cliProcessMain'], c));
		return mainCli.then(cli => cli.main(argv));
	} else {
		const env = assign({}, process.env, {
			// this will signal Code that it was spawned from this module
			'VSCODE_CLI': '1',
			'ELECTRON_NO_ATTACH_CONSOLE': '1'
		});
		delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];

		const child = spawn(process.execPath, args, {
			detached: true,
			stdio: 'ignore',
			env
		});

		if (argv.wait) {
			return new TPromise<void>(c => child.once('exit', ()=> c(null)));
		}
	}

	return TPromise.as(null);
}
开发者ID:13572293130,项目名称:vscode,代码行数:31,代码来源:cli.ts


示例9: fireScopedEvent

	private fireScopedEvent(handler: (event: any) => void, index) {
		if (index < 0) {
			return;
		}

		const element = this.items[index].element;
		handler(assign(event, { element, index }));
	}
开发者ID:asotog,项目名称:vscode,代码行数:8,代码来源:listView.ts


示例10: getEditorPartOptions

export function getEditorPartOptions(config: IWorkbenchEditorConfiguration): IEditorPartOptions {
	const options: IEditorPartOptions = assign(Object.create(null), DEFAULT_EDITOR_PART_OPTIONS);

	if (!config || !config.workbench) {
		return options;
	}

	if (typeof config.workbench.iconTheme === 'string') {
		options.iconTheme = config.workbench.iconTheme;
	}

	if (config.workbench.editor) {
		assign(options, config.workbench.editor);
	}

	return options;
}
开发者ID:kumarharsh,项目名称:vscode,代码行数:17,代码来源:editor.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript objects.clone函数代码示例发布时间:2022-05-25
下一篇:
TypeScript normalization.normalizeNFD函数代码示例发布时间: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