本文整理汇总了TypeScript中underscore.isUndefined函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isUndefined函数的具体用法?TypeScript isUndefined怎么用?TypeScript isUndefined使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isUndefined函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
'ifattr-type': function (typename: string, attr: string, context: HandlebarsContext, options) {
let hif = Handlebars.helpers['if'];
let ntObj = context.types[typename];
if (_.isUndefined(ntObj)) return hif.call(this, false, options);
if (_.isUndefined(ntObj.attrs)) return hif.call(this, false, options);
return hif.call(this, hb_attrfind(ntObj.attrs, attr), options);
},
示例2: detectFloat
this.forEach((el: any) => {
// console.log('getRowTypes', el);
// let float = parseFloat(el); // does not handle 1.000,12 well
let float = detectFloat(el);
let date = Date.parse(el);
let isDate = !!date && el.indexOf(',') == -1; // dates are without ","
let isEmpty = _.isNull(el)
|| _.isUndefined(el)
|| el == '';
let commas = 0;
if (_.isString(el)) {
commas = el.split(',').length - 1;
}
let elWithoutEUR = (el || '').replace('EUR', '').trim();
let onlyNumbers = /^[\-,\.\d]+$/.test(elWithoutEUR);
if (float && !isDate && commas == 1 && onlyNumbers) {
types.push('number');
} else if (isDate) {
types.push('date');
} else if (isEmpty) {
types.push('null');
} else {
types.push('string');
}
});
示例3: typeHandler
public static typeHandler(prop, hal, entityName, propType: Entity): boolean {
if (prop.type === 'string' && prop.format === 'uri') {
// This is a resource. Let's find it:
let propertyHal = this.findDeep(hal, 'name', entityName);
let propertyUrl = propertyHal.rt.split('#')[0];
// Since we don't have all the entities in the ResourceMap at this point,
// Create an empty entity with just the URL. It should be enough to attach
// the real entity later.
propType.isResource = true;
propType.url = propertyUrl;
return true;
} else if (!_.isUndefined(prop.$ref)) {
let complexEntityName = prop.$ref.split('/').pop();
propType.name = complexEntityName;
propType.isResource = false;
propType.url = complexEntityName;
return true;
}
return false;
};
示例4:
_.each(Setting.templates, (val, key) => {
if (!_.isEmpty(Setting.mp_idsTemplate) && _.isUndefined(Setting.mp_idsTemplate[val.getId()])) return;
$.consoleProccess(`Proccess '${val.getId()}' `);
if (!val.proccess(model, Setting.mp_outdir)) {
$.consoleError(`Error validation ${val.getLastDisplayError()}`);
process.exit(-1);
}
});
示例5: return
vm.loadouts = vm.loadouts.filter((loadout: Loadout) => {
return (vm.store.destinyVersion === 2
? loadout.destinyVersion === 2 : loadout.destinyVersion !== 2) &&
(_.isUndefined(loadout.platform) ||
loadout.platform === platform.platformLabel) &&
(vm.classTypeId === -1 ||
loadout.classType === -1 ||
loadout.classType === vm.classTypeId);
});
示例6:
_.each(model.properties, p => {
if (!this.isNativeType(p.type.name) ) {
// No duplicates by "Type" key
if (_.isUndefined(_.find(deps, dep => {
return dep.type.name === p.type.name;
}))) {
deps.push(p);
}
}
});
示例7: getOptions
private getOptions() {
var currentUser = window.localStorage.getItem('currentUser');
if (_.isUndefined(currentUser) || _.isNull(currentUser)) {
return null;
} else {
var token = JSON.parse(currentUser).token;
let headers = new Headers({ 'Authorization': 'JWT ' + token});
let options = new RequestOptions({ headers: headers });
return options;
}
}