本文整理匯總了TypeScript中vs/base/common/types.isUndefined函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isUndefined函數的具體用法?TypeScript isUndefined怎麽用?TypeScript isUndefined使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isUndefined函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
Object.keys(source).forEach((key: keyof T) => {
let destValue = destination[key];
let sourceValue = source[key];
if (Types.isUndefined(sourceValue)) {
return;
}
if (Types.isUndefined(destValue)) {
destination[key] = sourceValue;
} else {
if (overwrite) {
if (Types.isObject(destValue) && Types.isObject(sourceValue)) {
this.merge(destValue, sourceValue, overwrite);
} else {
destination[key] = sourceValue;
}
}
}
});
示例2: parseCommandOptions
private parseCommandOptions(json: Config.CommandOptions): CommandOptions {
let result: CommandOptions = {};
if (!json) {
return result;
}
if (this.is(json.cwd, Types.isString, ValidationState.Warning, NLS.localize('ExecutableParser.invalidCWD', 'Warning: options.cwd must be of type string. Ignoring value {0}.', json.cwd))) {
result.cwd = json.cwd;
}
if (!Types.isUndefined(json.env)) {
result.env = Objects.clone(json.env);
}
return result;
}
示例3: test
test('isUndefined', () => {
assert(!types.isUndefined(null));
assert(!types.isUndefined('foo'));
assert(!types.isUndefined([]));
assert(!types.isUndefined([1, 2, '3']));
assert(!types.isUndefined(true));
assert(!types.isUndefined({}));
assert(!types.isUndefined(/test/));
assert(!types.isUndefined(new RegExp('')));
assert(!types.isUndefined(new Date()));
assert(!types.isUndefined(assert));
assert(!types.isUndefined(function foo() { /**/ }));
assert(!types.isUndefined({ foo: 'bar' }));
assert(types.isUndefined(undefined));
});