UNPKG

tfsrestservice

Version:

Service which abstracts calls to the TFS/VSTS REST API and exposes the objects to the clients for further usage.

37 lines (28 loc) 910 B
/* * General Purpose Functions that can be reused across classes and tasks. */ export interface IGeneralFunctions { sleep(ms: number): Promise<void>; trimValues(values: string[]): string[]; trimValue(value: string): string; } export class GeneralFunctions implements IGeneralFunctions { public sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); } public trimValues(values: string[]): string[] { var returnValue: string[] = []; if (values != null) { values.forEach(value => { returnValue.push(this.trimValue(value)); }); } return returnValue; } public trimValue(value: string): string { if (value !== null && value !== undefined) { return value.trim(); } return value; } }