本文整理汇总了TypeScript中util.isNullOrUndefined函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isNullOrUndefined函数的具体用法?TypeScript isNullOrUndefined怎么用?TypeScript isNullOrUndefined使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isNullOrUndefined函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getSearchCountDataSets
/* searchText 제거
public getSearchCountDataSets(datasetId: string, searchWord: string, count: number) {
let popupService = this.popupService;
return this.get(this.API_URL + `preparationdatasets/${datasetId}/transform?searchWord=` + encodeURIComponent(searchWord) + '&targetLines=' + count)
*/
public getSearchCountDataSets(datasetId: string, ruleIdx?: number, pageNum?: number, count?: number) {
let popupService = this.popupService;
let url = this.API_URL + `preparationdatasets/${datasetId}/transform`;
const params: string[] = [];
if (isNullOrUndefined(ruleIdx)) {
(params.push(`ruleIdx=`));
} else {
(params.push(`ruleIdx=${ruleIdx}`));
}
(isNullOrUndefined(pageNum)) || (params.push(`offset=${pageNum}`));
(isNullOrUndefined(count)) || (params.push(`count=${count}`));
(0 < params.length) && (url = url + '?' + params.join('&'));
return this.get(url)
.catch((error) => {
if (true !== isUndefined(error.code) && error.code === 'PR5102') {
Loading.hide();
PreparationAlert.success(this.translateService.instant(error.details));
popupService.notiPopup({ name: 'update-dataflow', data: null });
return Promise.reject(null);
}
throw error;
});
}
开发者ID:bchin22,项目名称:metatron-discovery,代码行数:31,代码来源:dataflow.service.ts
示例2: createStory
.then((res: any) => {
return createStory(state.configuration.token, {
name: res.title,
description: res.description,
owner_ids: isNullOrUndefined(res.owner) ? null : [res.owner],
project_id: parseInt(res.project, 10),
epic_id: res.epic,
labels: isNullOrUndefined(res.labels) ? null : [res.labels],
story_type: res.storyType,
} as IStory)
.then((story: IStory) => {
const id = story.id;
const storySlug = slug(story.name).toLowerCase();
const gitCmd = `git checkout -b ${story.story_type}/ch${id}/${storySlug}`;
console.info(Chalk.green(`Successfully created a story with id ${id}`));
console.info("You can view your story at " + link(`https://app.clubhouse.io/story/${id}`));
console.info("To start working on this story (copied to clipboard): " + Chalk.bold(gitCmd));
writeSync(gitCmd);
return story;
})
.catch((err: any) => {
console.error(Chalk.red("There was an error processing your request"));
console.error(err.body);
});
});
开发者ID:tyrchen,项目名称:clubhouse-cli,代码行数:25,代码来源:index.ts
示例3:
Edges.forEach(function(Edge: edge) {
if(!(Util.isNullOrUndefined(Edge.to) || Util.isNullOrUndefined(Edge.from) || Util.isNullOrUndefined(Edge.rule)))
{
Ninja.edge(Edge.to).from(Edge.from).using(Edge.rule);
}
else
{
console.log('Invalid edge ', Edge, ' requires "to", "from" and "rule"')
}
});
开发者ID:HatiEth,项目名称:ethsset,代码行数:10,代码来源:ethsset.ts
示例4: isHttpUrl
/**
* Validator that checks if the control value is a http url.
*
* @param control
* @returns {{isUri: boolean}}
*/
static isHttpUrl(control: AbstractControl): ValidationErrors | null {
const value = control.value;
let match = isNullOrUndefined(value) ? null : parseUri(value);
return (isNullOrUndefined(match)
|| match[1].indexOf('http') !== 0 // check for protocol http(s)
|| match[2] !== '//' // check for both // after protocol
|| match[4].trim().length === 0 // check that host is given
) ?
{'isHttpUrl': true} : null;
}
开发者ID:ZGIS,项目名称:smart-portal-webgui,代码行数:17,代码来源:validators.sac.ts
示例5: appendAuthenticationToken
private appendAuthenticationToken(options?: RequestOptionsArgs) {
if (isNullOrUndefined(options)) {
options = new RequestOptions();
}
if (isNullOrUndefined(options.headers)) {
options.headers = new Headers();
}
options.headers.append('Accept', 'application/json');
if (localStorage.getItem('oauth')) {
options.withCredentials = true;
options.headers.append('Authorization', 'Bearer ' + this.getToken());
}
return options;
}
开发者ID:k20human,项目名称:jarvis,代码行数:14,代码来源:secure-http.service.ts
示例6: setGoEnvironmentVariables
function setGoEnvironmentVariables(goRoot: string) {
tl.setVariable('GOROOT', goRoot);
let goPath: string = tl.getInput("goPath", false);
let goBin: string = tl.getInput("goBin", false);
// set GOPATH and GOBIN as user value
if (!util.isNullOrUndefined(goPath)) {
tl.setVariable("GOPATH", goPath);
}
if (!util.isNullOrUndefined(goBin)) {
tl.setVariable("GOBIN", goBin);
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:14,代码来源:gotool.ts
示例7: getLicense
/**
* getLicense returns License instance with licenser.license setting.
* @param typ License type specified in settings.json.
*/
private getLicense(typ: string): License {
let licenserSetting = vscode.workspace.getConfiguration("licenser");
let projectName = licenserSetting.get<string>("projectName", undefined);
console.log("Project Name from settings: " + projectName);
if (projectName !== undefined && projectName === "") {
let root = vscode.workspace.rootPath;
projectName = path.basename(root);
}
console.log("Project Name used: " + projectName);
const licenseKey = typ.toUpperCase();
if (licenseKey === "CUSTOM") {
let customTermsAndConditions = licenserSetting.get<string>("customTermsAndConditions");
let customHeader = licenserSetting.get<string>("customHeader");
let fileName = vscode.window.activeTextEditor.document.fileName;
return new Custom(this.author, projectName, customTermsAndConditions, customHeader, fileName);
}
let info = availableLicenses.get(licenseKey);
if (isNullOrUndefined(info)) {
info = availableLicenses.get(defaultLicenseType);
}
return info.creatorFn(this.author, projectName);
}
开发者ID:ymotongpoo,项目名称:vsc-licenser,代码行数:29,代码来源:extension.ts
示例8:
static getValidValue<T>(field: T, value: T): T {
if (isNullOrUndefined(field)) {
return value;
} else {
return field;
}
}
开发者ID:tellxp,项目名称:avengers,代码行数:7,代码来源:widget.ts
示例9: constructor
constructor(graph: Remath, initialState: ISymbolState) {
super(graph, initialState);
this._symbol = null;
if (!initialState || isNullOrUndefined(initialState.symbol)) throw Error('must provide a symbol when creating a cell');
this.updateSymbol(initialState.symbol);
this._tempInvalidSymbol = null;
}
开发者ID:trevorhanus,项目名称:reMath,代码行数:7,代码来源:Symbol.ts
示例10: FormMetadata
return metadataArray.map(item => {
if (isNullOrUndefined(entity)) {
return new FormMetadata(item);
} else {
return new FormMetadata(item, entity);
}
});
开发者ID:michalzeman,项目名称:angular2-training,代码行数:7,代码来源:form-metadata.ts
示例11: constructor
constructor(public metadata: DomainMetadata,
value?: any | ValueObject) {
// if (value && value[metadata.key]) {
// this.defValue = value[metadata.key];
// }
if (!isNullOrUndefined(value)) {
if (value instanceof ValueObject) {
if (!isNullOrUndefined(value.value)) {
this.defValue = value.value[metadata.key];
}
this.list = value.list;
} else {
this.defValue = value[metadata.key];
}
}
}
开发者ID:michalzeman,项目名称:angular2-training,代码行数:16,代码来源:form-metadata.ts
示例12: getDatasetWrangledData
} // function - transformAction
// Wrangled 데이터셋 조회 (조인과 유니온에서 사용)
public getDatasetWrangledData(datasetId: string, count?: number, pageNum?: number, ruleIdx?: number): Promise<any> {
// TODO : temp value
count = 1000;
pageNum = 0;
let url = this.API_URL + `preparationdatasets/${datasetId}/transform`;
const params: string[] = [];
(params.push(`ruleIdx=`));
(isNullOrUndefined(pageNum)) || (params.push(`offset=${pageNum}`));
(isNullOrUndefined(count)) || (params.push(`count=${count}`));
(0 < params.length) && (url = url + '?' + params.join('&'));
return this.get(url);
}
开发者ID:bchin22,项目名称:metatron-discovery,代码行数:20,代码来源:dataflow.service.ts
示例13: buildAndInsertMediumByFilePathAsync
private async buildAndInsertMediumByFilePathAsync(
mediumFilePath: string,
index: number
): Promise<IMediumModel> {
const normalizedMediumFilePath = this.fileExplorerService.normalizePathForCurrentOs(mediumFilePath);
let model = await MediumModel.buildFromFilePathAsync(
this.mediaService,
this.mediaRepository,
() => this.index,
normalizedMediumFilePath
);
const medium = await this.mediaRepository.addMediumAsync(model.toEntity());
model.setFromEntity(medium);
if (isNullOrUndefined(index)) { // We'll append medium
const media = await this.media.valueAsync;
media.push(model);
} else {
const media = await this.media.valueAsync;
media.splice(index, 0, model);
}
return model;
}
开发者ID:sebthieti,项目名称:jogplayer-online,代码行数:25,代码来源:playlist.model.ts
示例14: init
init() {
this.activePage = null;
this.docked = false;
this.state = 'collapsed';
if (isNullOrUndefined(this.height)) {
this.height = 60;
}
}
开发者ID:tellxp,项目名称:avengers,代码行数:8,代码来源:tabstrip-panel.component.ts
示例15: getAutoCompleteChoices
function getAutoCompleteChoices(input: string, data: ChoiceOption[]) {
if (isNullOrUndefined(input)) {
return Promise.resolve(data);
} else {
const filtered = data
.filter((item: ChoiceOption) => item.name.toLowerCase().includes(input.toLowerCase()));
return Promise.resolve(filtered);
}
}
开发者ID:tyrchen,项目名称:clubhouse-cli,代码行数:9,代码来源:index.ts
示例16: createStory
export function createStory(token: string, story: IStory): Promise<IStory> {
const client = require('clubhouse-lib').create(token);
const reqObj = pick(story, ['name', 'description', 'story_type', 'epic_id', 'project_id', 'labels']) as any;
if (!isNullOrUndefined(story.owner_ids)) {
reqObj.owner_ids = Array.isArray(story.owner_ids) ? story.owner_ids : [story.owner_ids];
}
return client.createStory(reqObj);
}
开发者ID:tyrchen,项目名称:clubhouse-cli,代码行数:9,代码来源:clubhouse.ts
示例17: canActivate
canActivate() {
let sessionToken = this.cookieService.get('sessionToken');
if (isNullOrUndefined(sessionToken)) {
this.stateService.setLoggedOut();
// noinspection JSIgnoredPromiseFromCall
this.router.navigateByUrl('not-logged-in');
}
return sessionToken != null;
}
开发者ID:crispab,项目名称:codekvast,代码行数:10,代码来源:is-logged-in.ts
示例18:
operation.steps.forEach((step: OperationStep) => {
const newStep = {
...step
};
if (!isNullOrUndefined(newStep.move)) {
newStep.move -= totalMoves;
}
this.steps.push(newStep);
});
开发者ID:ceottaki,项目名称:reedsy-challenge-node-q5,代码行数:10,代码来源:index.ts
示例19: activateItem
activateItem(item: MenuItemComponent) {
if (isNullOrUndefined(this.activeItem)) {
this.activeItem = item;
this.activeItem.activate();
} else {
this.activeItem.deactivate();
this.activeItem = item;
this.activeItem.activate();
}
}
开发者ID:tellxp,项目名称:avengers,代码行数:10,代码来源:menu-entry.component.ts
示例20: _chooseLicenseType
private _chooseLicenseType(): Thenable<string> {
let licenserSetting = vscode.workspace.getConfiguration("licenser");
let licenseType = licenserSetting.get<string>("license");
if (isNullOrUndefined(licenseType) || licenseType.toLowerCase() == chooseFromList) {
return vscode.window.showQuickPick(Array.from(availableLicenses.values()).map(info => info.displayName));
}
return new Promise((resolve, _) => resolve(licenseType));
}
开发者ID:ymotongpoo,项目名称:vsc-licenser,代码行数:10,代码来源:extension.ts
注:本文中的util.isNullOrUndefined函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论