本文整理匯總了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;
}
}