diff --git a/modules/@angular/benchpress/src/web_driver_extension.ts b/modules/@angular/benchpress/src/web_driver_extension.ts index 06030e17a4..83e605c7f7 100644 --- a/modules/@angular/benchpress/src/web_driver_extension.ts +++ b/modules/@angular/benchpress/src/web_driver_extension.ts @@ -9,7 +9,6 @@ import {Injector, OpaqueToken} from '@angular/core'; import {Options} from './common_options'; -import {isBlank} from './facade/lang'; export type PerfLogEvent = { [key: string]: any @@ -50,7 +49,7 @@ export abstract class WebDriverExtension { delegate = extension; } }); - if (isBlank(delegate)) { + if (!delegate) { throw new Error('Could not find a delegate for given capabilities!'); } return delegate; diff --git a/modules/@angular/benchpress/src/webdriver/ios_driver_extension.ts b/modules/@angular/benchpress/src/webdriver/ios_driver_extension.ts index 0259485bcb..00bc1d9808 100644 --- a/modules/@angular/benchpress/src/webdriver/ios_driver_extension.ts +++ b/modules/@angular/benchpress/src/webdriver/ios_driver_extension.ts @@ -52,7 +52,7 @@ export class IOsDriverExtension extends WebDriverExtension { /** @internal */ private _convertPerfRecordsToEvents(records: any[], events: PerfLogEvent[] = null) { - if (isBlank(events)) { + if (!events) { events = []; } records.forEach((record) => { diff --git a/modules/@angular/benchpress/test/metric/perflog_metric_spec.ts b/modules/@angular/benchpress/test/metric/perflog_metric_spec.ts index 84f113e3a1..eab81efd8b 100644 --- a/modules/@angular/benchpress/test/metric/perflog_metric_spec.ts +++ b/modules/@angular/benchpress/test/metric/perflog_metric_spec.ts @@ -11,7 +11,7 @@ import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@ang import {Metric, Options, PerfLogEvent, PerfLogFeatures, PerflogMetric, ReflectiveInjector, WebDriverExtension} from '../../index'; import {StringMapWrapper} from '../../src/facade/collection'; -import {isBlank, isPresent} from '../../src/facade/lang'; +import {isPresent} from '../../src/facade/lang'; import {TraceEventFactory} from '../trace_event_factory'; export function main() { @@ -28,11 +28,11 @@ export function main() { requestCount?: boolean } = {}): Metric { commandLog = []; - if (isBlank(perfLogFeatures)) { + if (!perfLogFeatures) { perfLogFeatures = new PerfLogFeatures({render: true, gc: true, frameCapture: true, userTiming: true}); } - if (isBlank(microMetrics)) { + if (!microMetrics) { microMetrics = {}; } var providers: Provider[] = [ diff --git a/modules/@angular/benchpress/test/metric/user_metric_spec.ts b/modules/@angular/benchpress/test/metric/user_metric_spec.ts index 5680e216d8..22ebb45276 100644 --- a/modules/@angular/benchpress/test/metric/user_metric_spec.ts +++ b/modules/@angular/benchpress/test/metric/user_metric_spec.ts @@ -10,7 +10,6 @@ import {Provider, ReflectiveInjector} from '@angular/core'; import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/testing/testing_internal'; import {Options, PerfLogEvent, PerfLogFeatures, UserMetric, WebDriverAdapter} from '../../index'; -import {isBlank} from '../../src/facade/lang'; export function main() { var wdAdapter: MockDriverAdapter; @@ -18,11 +17,11 @@ export function main() { function createMetric( perfLogs: PerfLogEvent[], perfLogFeatures: PerfLogFeatures, {userMetrics}: {userMetrics?: {[key: string]: string}} = {}): UserMetric { - if (isBlank(perfLogFeatures)) { + if (!perfLogFeatures) { perfLogFeatures = new PerfLogFeatures({render: true, gc: true, frameCapture: true, userTiming: true}); } - if (isBlank(userMetrics)) { + if (!userMetrics) { userMetrics = {}; } wdAdapter = new MockDriverAdapter(); diff --git a/modules/@angular/benchpress/test/reporter/console_reporter_spec.ts b/modules/@angular/benchpress/test/reporter/console_reporter_spec.ts index 5fc5ae3798..c3b1a093fa 100644 --- a/modules/@angular/benchpress/test/reporter/console_reporter_spec.ts +++ b/modules/@angular/benchpress/test/reporter/console_reporter_spec.ts @@ -25,7 +25,7 @@ export function main() { metrics?: {[key: string]: any} }) { log = []; - if (isBlank(descriptions)) { + if (!descriptions) { descriptions = []; } if (isBlank(sampleId)) { diff --git a/modules/@angular/benchpress/test/runner_spec.ts b/modules/@angular/benchpress/test/runner_spec.ts index 6121ac6bcd..d5399a247e 100644 --- a/modules/@angular/benchpress/test/runner_spec.ts +++ b/modules/@angular/benchpress/test/runner_spec.ts @@ -9,7 +9,6 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/testing/testing_internal'; import {Injector, Metric, Options, ReflectiveInjector, Runner, SampleDescription, SampleState, Sampler, Validator, WebDriverAdapter} from '../index'; -import {isBlank} from '../src/facade/lang'; export function main() { describe('runner', () => { @@ -17,7 +16,7 @@ export function main() { var runner: Runner; function createRunner(defaultProviders: any[] = null): Runner { - if (isBlank(defaultProviders)) { + if (!defaultProviders) { defaultProviders = []; } runner = new Runner([ diff --git a/modules/@angular/benchpress/test/sampler_spec.ts b/modules/@angular/benchpress/test/sampler_spec.ts index 4d91120e7c..345d2865ad 100644 --- a/modules/@angular/benchpress/test/sampler_spec.ts +++ b/modules/@angular/benchpress/test/sampler_spec.ts @@ -26,10 +26,10 @@ export function main() { execute?: any } = {}) { var time = 1000; - if (isBlank(metric)) { + if (!metric) { metric = new MockMetric([]); } - if (isBlank(reporter)) { + if (!reporter) { reporter = new MockReporter([]); } if (isBlank(driver)) { diff --git a/modules/@angular/benchpress/test/webdriver/chrome_driver_extension_spec.ts b/modules/@angular/benchpress/test/webdriver/chrome_driver_extension_spec.ts index 3f28baa57c..f3ab34ecd3 100644 --- a/modules/@angular/benchpress/test/webdriver/chrome_driver_extension_spec.ts +++ b/modules/@angular/benchpress/test/webdriver/chrome_driver_extension_spec.ts @@ -35,7 +35,7 @@ export function main() { function createExtension( perfRecords: any[] = null, userAgent: string = null, messageMethod = 'Tracing.dataCollected'): WebDriverExtension { - if (isBlank(perfRecords)) { + if (!perfRecords) { perfRecords = []; } if (isBlank(userAgent)) { diff --git a/modules/@angular/benchpress/test/webdriver/ios_driver_extension_spec.ts b/modules/@angular/benchpress/test/webdriver/ios_driver_extension_spec.ts index 242fef4073..5ed46b5fd5 100644 --- a/modules/@angular/benchpress/test/webdriver/ios_driver_extension_spec.ts +++ b/modules/@angular/benchpress/test/webdriver/ios_driver_extension_spec.ts @@ -9,7 +9,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/testing/testing_internal'; import {IOsDriverExtension, ReflectiveInjector, WebDriverAdapter, WebDriverExtension} from '../../index'; -import {Json, isBlank} from '../../src/facade/lang'; +import {Json} from '../../src/facade/lang'; import {TraceEventFactory} from '../trace_event_factory'; export function main() { @@ -20,7 +20,7 @@ export function main() { var normEvents = new TraceEventFactory('timeline', 'pid0'); function createExtension(perfRecords: any[] = null): WebDriverExtension { - if (isBlank(perfRecords)) { + if (!perfRecords) { perfRecords = []; } log = []; @@ -156,7 +156,7 @@ function timeEndRecord(name: string, time: number) { } function durationRecord(type: string, startTime: number, endTime: number, children: any[] = null) { - if (isBlank(children)) { + if (!children) { children = []; } return {'type': type, 'startTime': startTime, 'endTime': endTime, 'children': children}; diff --git a/modules/@angular/common/test/pipes/async_pipe_spec.ts b/modules/@angular/common/test/pipes/async_pipe_spec.ts index d125c41613..4f4f0309f6 100644 --- a/modules/@angular/common/test/pipes/async_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/async_pipe_spec.ts @@ -13,7 +13,6 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {browserDetection} from '@angular/platform-browser/testing/browser_util'; import {EventEmitter} from '../../src/facade/async'; -import {isBlank} from '../../src/facade/lang'; import {SpyChangeDetectorRef} from '../spies'; export function main() { @@ -112,7 +111,7 @@ export function main() { var promise: Promise; var ref: SpyChangeDetectorRef; // adds longer timers for passing tests in IE - var timer = (!isBlank(getDOM()) && browserDetection.isIE) ? 50 : 10; + var timer = (getDOM() && browserDetection.isIE) ? 50 : 10; beforeEach(() => { promise = new Promise((res, rej) => { diff --git a/modules/@angular/compiler-cli/test/static_reflector_spec.ts b/modules/@angular/compiler-cli/test/static_reflector_spec.ts index d44e8c2121..75f8c823f8 100644 --- a/modules/@angular/compiler-cli/test/static_reflector_spec.ts +++ b/modules/@angular/compiler-cli/test/static_reflector_spec.ts @@ -454,7 +454,7 @@ class MockReflectorHost implements StaticReflectorHost { getStaticSymbol(declarationFile: string, name: string, members?: string[]): StaticSymbol { var cacheKey = `${declarationFile}:${name}${members?'.'+members.join('.'):''}`; var result = this.staticTypeCache.get(cacheKey); - if (isBlank(result)) { + if (!result) { result = new StaticSymbol(declarationFile, name, members); this.staticTypeCache.set(cacheKey, result); } diff --git a/modules/@angular/compiler/src/animation/animation_compiler.ts b/modules/@angular/compiler/src/animation/animation_compiler.ts index 3399e8e800..0622068c18 100644 --- a/modules/@angular/compiler/src/animation/animation_compiler.ts +++ b/modules/@angular/compiler/src/animation/animation_compiler.ts @@ -7,7 +7,7 @@ */ import {StringMapWrapper} from '../facade/collection'; -import {isBlank, isPresent} from '../facade/lang'; +import {isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; import {ANY_STATE, DEFAULT_STATE, EMPTY_STATE} from '../private_import_core'; @@ -323,7 +323,7 @@ class _AnimationBuilderStateMap { get states() { return this._states; } registerState(name: string, value: {[prop: string]: string | number} = null): void { var existingEntry = this._states[name]; - if (isBlank(existingEntry)) { + if (!existingEntry) { this._states[name] = value; } } diff --git a/modules/@angular/compiler/src/ml_parser/parser.ts b/modules/@angular/compiler/src/ml_parser/parser.ts index 1dcf48a14a..47e7c6272e 100644 --- a/modules/@angular/compiler/src/ml_parser/parser.ts +++ b/modules/@angular/compiler/src/ml_parser/parser.ts @@ -123,7 +123,7 @@ class _TreeBuilder { // read = while (this._peek.type === lex.TokenType.EXPANSION_CASE_VALUE) { let expCase = this._parseExpansionCase(); - if (isBlank(expCase)) return; // error + if (!expCase) return; // error cases.push(expCase); } @@ -154,7 +154,7 @@ class _TreeBuilder { const start = this._advance(); const exp = this._collectExpansionExpTokens(start); - if (isBlank(exp)) return null; + if (!exp) return null; const end = this._advance(); exp.push(new lex.Token(lex.TokenType.EOF, [], end.sourceSpan)); diff --git a/modules/@angular/compiler/src/ng_module_compiler.ts b/modules/@angular/compiler/src/ng_module_compiler.ts index 42e4910d92..480ee0fadf 100644 --- a/modules/@angular/compiler/src/ng_module_compiler.ts +++ b/modules/@angular/compiler/src/ng_module_compiler.ts @@ -9,7 +9,7 @@ import {Injectable} from '@angular/core'; import {CompileDiDependencyMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompileProviderMetadata, CompileTokenMetadata} from './compile_metadata'; -import {isBlank, isPresent} from './facade/lang'; +import {isPresent} from './facade/lang'; import {Identifiers, resolveIdentifier, resolveIdentifierToken} from './identifiers'; import * as o from './output/output_ast'; import {convertValueToOutputAst} from './output/value_util'; @@ -190,7 +190,7 @@ class _InjectorBuilder { resolvedProviderValueExpr = providerValueExpressions[0]; type = providerValueExpressions[0].type; } - if (isBlank(type)) { + if (!type) { type = o.DYNAMIC_TYPE; } if (isEager) { @@ -223,11 +223,11 @@ class _InjectorBuilder { resolveIdentifierToken(Identifiers.ComponentFactoryResolver).reference)) { result = o.THIS_EXPR; } - if (isBlank(result)) { + if (!result) { result = this._instances.get(dep.token.reference); } } - if (isBlank(result)) { + if (!result) { var args = [createDiTokenExpression(dep.token)]; if (dep.isOptional) { args.push(o.NULL_EXPR); diff --git a/modules/@angular/compiler/src/output/output_ast.ts b/modules/@angular/compiler/src/output/output_ast.ts index f81c5278d7..d64eb1b4c9 100644 --- a/modules/@angular/compiler/src/output/output_ast.ts +++ b/modules/@angular/compiler/src/output/output_ast.ts @@ -8,7 +8,7 @@ import {CompileIdentifierMetadata} from '../compile_metadata'; -import {isBlank, isPresent, isString} from '../facade/lang'; +import {isPresent, isString} from '../facade/lang'; @@ -19,7 +19,7 @@ export enum TypeModifier { export abstract class Type { constructor(public modifiers: TypeModifier[] = null) { - if (isBlank(modifiers)) { + if (!modifiers) { this.modifiers = []; } } @@ -462,7 +462,7 @@ export enum StmtModifier { export abstract class Statement { constructor(public modifiers: StmtModifier[] = null) { - if (isBlank(modifiers)) { + if (!modifiers) { this.modifiers = []; } } @@ -517,7 +517,7 @@ export class ReturnStatement extends Statement { export class AbstractClassPart { constructor(public type: Type = null, public modifiers: StmtModifier[]) { - if (isBlank(modifiers)) { + if (!modifiers) { this.modifiers = []; } } diff --git a/modules/@angular/compiler/src/provider_analyzer.ts b/modules/@angular/compiler/src/provider_analyzer.ts index 91575e1329..f1c2901d99 100644 --- a/modules/@angular/compiler/src/provider_analyzer.ts +++ b/modules/@angular/compiler/src/provider_analyzer.ts @@ -136,10 +136,9 @@ export class ProviderElementContext { requestingProviderType: ProviderAstType, token: CompileTokenMetadata, eager: boolean): ProviderAst { var resolvedProvider = this._allProviders.get(token.reference); - if (isBlank(resolvedProvider) || - ((requestingProviderType === ProviderAstType.Directive || - requestingProviderType === ProviderAstType.PublicService) && - resolvedProvider.providerType === ProviderAstType.PrivateService) || + if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive || + requestingProviderType === ProviderAstType.PublicService) && + resolvedProvider.providerType === ProviderAstType.PrivateService) || ((requestingProviderType === ProviderAstType.PrivateService || requestingProviderType === ProviderAstType.PublicService) && resolvedProvider.providerType === ProviderAstType.Builtin)) { @@ -239,12 +238,12 @@ export class ProviderElementContext { result = this._getLocalDependency(requestingProviderType, dep, eager); } if (dep.isSelf) { - if (isBlank(result) && dep.isOptional) { + if (!result && dep.isOptional) { result = new CompileDiDependencyMetadata({isValue: true, value: null}); } } else { // check parent elements - while (isBlank(result) && isPresent(currElement._parent)) { + while (!result && isPresent(currElement._parent)) { var prevElement = currElement; currElement = currElement._parent; if (prevElement._isViewRoot) { @@ -253,7 +252,7 @@ export class ProviderElementContext { result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager); } // check @Host restriction - if (isBlank(result)) { + if (!result) { if (!dep.isHost || this.viewContext.component.type.isHost || this.viewContext.component.type.reference === dep.token.reference || isPresent(this.viewContext.viewProviders.get(dep.token.reference))) { @@ -265,7 +264,7 @@ export class ProviderElementContext { } } } - if (isBlank(result)) { + if (!result) { this.viewContext.errors.push( new ProviderError(`No provider for ${dep.token.name}`, this._sourceSpan)); } @@ -311,7 +310,7 @@ export class NgModuleProviderAnalyzer { private _getOrCreateLocalProvider(token: CompileTokenMetadata, eager: boolean): ProviderAst { var resolvedProvider = this._allProviders.get(token.reference); - if (isBlank(resolvedProvider)) { + if (!resolvedProvider) { return null; } var transformedProviderAst = this._transformedProviders.get(token.reference); @@ -414,7 +413,7 @@ function _normalizeProviders( providers: Array, sourceSpan: ParseSourceSpan, targetErrors: ParseError[], targetProviders: CompileProviderMetadata[] = null): CompileProviderMetadata[] { - if (isBlank(targetProviders)) { + if (!targetProviders) { targetProviders = []; } if (isPresent(providers)) { @@ -479,7 +478,7 @@ function _resolveProviders( `Mixing multi and non multi provider is not possible for token ${resolvedProvider.token.name}`, sourceSpan)); } - if (isBlank(resolvedProvider)) { + if (!resolvedProvider) { const lifecycleHooks = provider.token.identifier && provider.token.identifier instanceof CompileTypeMetadata ? provider.token.identifier.lifecycleHooks : @@ -530,7 +529,7 @@ function _getContentQueries(directives: CompileDirectiveMetadata[]): function _addQueryToTokenMap(map: Map, query: CompileQueryMetadata) { query.selectors.forEach((token: CompileTokenMetadata) => { var entry = map.get(token.reference); - if (isBlank(entry)) { + if (!entry) { entry = []; map.set(token.reference, entry); } diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index 80c96eaf29..f91af0272e 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -12,7 +12,7 @@ import {AnimationParser} from './animation/animation_parser'; import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, ProviderMeta, createHostComponentMeta} from './compile_metadata'; import {CompilerConfig} from './config'; import {DirectiveNormalizer} from './directive_normalizer'; -import {isBlank, stringify} from './facade/lang'; +import {stringify} from './facade/lang'; import {CompileMetadataResolver} from './metadata_resolver'; import {NgModuleCompiler} from './ng_module_compiler'; import * as ir from './output/output_ast'; @@ -191,7 +191,7 @@ export class RuntimeCompiler implements Compiler { private _createCompiledHostTemplate(compType: Type): CompiledTemplate { var compiledTemplate = this._compiledHostTemplateCache.get(compType); - if (isBlank(compiledTemplate)) { + if (!compiledTemplate) { var compMeta = this._metadataResolver.getDirectiveMetadata(compType); assertComponent(compMeta); var hostMeta = createHostComponentMeta(compMeta); @@ -206,7 +206,7 @@ export class RuntimeCompiler implements Compiler { private _createCompiledTemplate( compMeta: CompileDirectiveMetadata, ngModule: CompileNgModuleMetadata): CompiledTemplate { var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference); - if (isBlank(compiledTemplate)) { + if (!compiledTemplate) { assertComponent(compMeta); compiledTemplate = new CompiledTemplate( false, compMeta.selector, compMeta.type, ngModule.transitiveModule.directives, diff --git a/modules/@angular/compiler/src/selector.ts b/modules/@angular/compiler/src/selector.ts index b1408f8e9d..5c68d49225 100644 --- a/modules/@angular/compiler/src/selector.ts +++ b/modules/@angular/compiler/src/selector.ts @@ -216,7 +216,7 @@ export class SelectorMatcher { if (isTerminal) { var terminalMap = matcher._attrValueMap; var terminalValuesMap = terminalMap.get(attrName); - if (isBlank(terminalValuesMap)) { + if (!terminalValuesMap) { terminalValuesMap = new Map(); terminalMap.set(attrName, terminalValuesMap); } @@ -224,7 +224,7 @@ export class SelectorMatcher { } else { var parttialMap = matcher._attrValuePartialMap; var partialValuesMap = parttialMap.get(attrName); - if (isBlank(partialValuesMap)) { + if (!partialValuesMap) { partialValuesMap = new Map(); parttialMap.set(attrName, partialValuesMap); } @@ -237,7 +237,7 @@ export class SelectorMatcher { private _addTerminal( map: Map, name: string, selectable: SelectorContext) { var terminalList = map.get(name); - if (isBlank(terminalList)) { + if (!terminalList) { terminalList = []; map.set(name, terminalList); } @@ -246,7 +246,7 @@ export class SelectorMatcher { private _addPartial(map: Map, name: string): SelectorMatcher { var matcher = map.get(name); - if (isBlank(matcher)) { + if (!matcher) { matcher = new SelectorMatcher(); map.set(name, matcher); } @@ -316,7 +316,7 @@ export class SelectorMatcher { _matchTerminal( map: Map, name: string, cssSelector: CssSelector, matchedCallback: (c: CssSelector, a: any) => void): boolean { - if (isBlank(map) || isBlank(name)) { + if (!map || isBlank(name)) { return false; } @@ -325,7 +325,7 @@ export class SelectorMatcher { if (isPresent(starSelectables)) { selectables = selectables.concat(starSelectables); } - if (isBlank(selectables)) { + if (!selectables) { return false; } var selectable: SelectorContext; @@ -341,11 +341,11 @@ export class SelectorMatcher { _matchPartial( map: Map, name: string, cssSelector: CssSelector, matchedCallback: (c: CssSelector, a: any) => void): boolean { - if (isBlank(map) || isBlank(name)) { + if (!map || isBlank(name)) { return false; } var nestedSelector = map.get(name); - if (isBlank(nestedSelector)) { + if (!nestedSelector) { return false; } // TODO(perf): get rid of recursion and measure again @@ -374,13 +374,11 @@ export class SelectorContext { finalize(cssSelector: CssSelector, callback: (c: CssSelector, a: any) => void): boolean { var result = true; - if (this.notSelectors.length > 0 && - (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) { var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); result = !notMatcher.match(cssSelector, null); } - if (result && isPresent(callback) && - (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (result && isPresent(callback) && (!this.listContext || !this.listContext.alreadyMatched)) { if (isPresent(this.listContext)) { this.listContext.alreadyMatched = true; } diff --git a/modules/@angular/compiler/src/template_parser/template_parser.ts b/modules/@angular/compiler/src/template_parser/template_parser.ts index 1f3c58fee3..5710605bd6 100644 --- a/modules/@angular/compiler/src/template_parser/template_parser.ts +++ b/modules/@angular/compiler/src/template_parser/template_parser.ts @@ -12,7 +12,7 @@ import {CompileDirectiveMetadata, CompilePipeMetadata, CompileTemplateMetadata, import {AST, ASTWithSource, BindingPipe, EmptyExpr, Interpolation, ParserError, RecursiveAstVisitor, TemplateBinding} from '../expression_parser/ast'; import {Parser} from '../expression_parser/parser'; import {StringMapWrapper} from '../facade/collection'; -import {isBlank, isPresent, isString} from '../facade/lang'; +import {isPresent, isString} from '../facade/lang'; import {I18NHtmlParser} from '../i18n/i18n_html_parser'; import {Identifiers, identifierToken, resolveIdentifierToken} from '../identifiers'; import * as html from '../ml_parser/ast'; @@ -869,7 +869,7 @@ class TemplateParseVisitor implements html.Visitor { const boundPropsByName = new Map(); boundProps.forEach(boundProp => { const prevValue = boundPropsByName.get(boundProp.name); - if (isBlank(prevValue) || prevValue.isLiteral) { + if (!prevValue || prevValue.isLiteral) { // give [a]="b" a higher precedence than a="b" on the same element boundPropsByName.set(boundProp.name, boundProp); } @@ -900,7 +900,7 @@ class TemplateParseVisitor implements html.Visitor { }); props.forEach((prop: BoundElementOrDirectiveProperty) => { - if (!prop.isLiteral && isBlank(boundDirectivePropsIndex.get(prop.name))) { + if (!prop.isLiteral && !boundDirectivePropsIndex.get(prop.name)) { boundElementProps.push(this._createElementPropertyAst( elementName, prop.name, prop.expression, prop.sourceSpan)); } diff --git a/modules/@angular/compiler/src/view_compiler/compile_element.ts b/modules/@angular/compiler/src/view_compiler/compile_element.ts index 01ee5d8cff..575929a789 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_element.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_element.ts @@ -9,7 +9,7 @@ import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileIdentifierMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTokenMetadata} from '../compile_metadata'; import {ListWrapper, MapWrapper, StringMapWrapper} from '../facade/collection'; -import {isBlank, isPresent} from '../facade/lang'; +import {isPresent} from '../facade/lang'; import {Identifiers, identifierToken, resolveIdentifier, resolveIdentifierToken} from '../identifiers'; import * as o from '../output/output_ast'; import {convertValueToOutputAst} from '../output/value_util'; @@ -27,7 +27,7 @@ export class CompileNode { public parent: CompileElement, public view: CompileView, public nodeIndex: number, public renderNode: o.Expression, public sourceAst: TemplateAst) {} - isNull(): boolean { return isBlank(this.renderNode); } + isNull(): boolean { return !this.renderNode; } isRootElement(): boolean { return this.view != this.parent.view; } } @@ -313,12 +313,12 @@ export class CompileElement extends CompileNode { requestingProviderType: ProviderAstType, dep: CompileDiDependencyMetadata): o.Expression { var result: o.Expression = null; // constructor content query - if (isBlank(result) && isPresent(dep.query)) { + if (!result && isPresent(dep.query)) { result = this._addQuery(dep.query, null).queryList; } // constructor view query - if (isBlank(result) && isPresent(dep.viewQuery)) { + if (!result && isPresent(dep.viewQuery)) { result = createQueryList( dep.viewQuery, null, `_viewQuery_${dep.viewQuery.selectors[0].name}_${this.nodeIndex}_${this._componentConstructorViewQueryLists.length}`, @@ -328,7 +328,7 @@ export class CompileElement extends CompileNode { if (isPresent(dep.token)) { // access builtins with special visibility - if (isBlank(result)) { + if (!result) { if (dep.token.reference === resolveIdentifierToken(Identifiers.ChangeDetectorRef).reference) { if (requestingProviderType === ProviderAstType.Component) { @@ -339,7 +339,7 @@ export class CompileElement extends CompileNode { } } // access regular providers on the element - if (isBlank(result)) { + if (!result) { let resolvedProvider = this._resolvedProviders.get(dep.token.reference); // don't allow directives / public services to access private services. // only components and private services can access private services. @@ -361,20 +361,20 @@ export class CompileElement extends CompileNode { if (dep.isValue) { result = o.literal(dep.value); } - if (isBlank(result) && !dep.isSkipSelf) { + if (!result && !dep.isSkipSelf) { result = this._getLocalDependency(requestingProviderType, dep); } // check parent elements - while (isBlank(result) && !currElement.parent.isNull()) { + while (!result && !currElement.parent.isNull()) { currElement = currElement.parent; result = currElement._getLocalDependency( ProviderAstType.PublicService, new CompileDiDependencyMetadata({token: dep.token})); } - if (isBlank(result)) { + if (!result) { result = injectFromViewParentInjector(dep.token, dep.isOptional); } - if (isBlank(result)) { + if (!result) { result = o.NULL_EXPR; } return getPropertyInView(result, this.view, currElement.view); @@ -411,7 +411,7 @@ function createProviderProperty( resolvedProviderValueExpr = providerValueExpressions[0]; type = providerValueExpressions[0].type; } - if (isBlank(type)) { + if (!type) { type = o.DYNAMIC_TYPE; } if (isEager) { diff --git a/modules/@angular/compiler/src/view_compiler/compile_pipe.ts b/modules/@angular/compiler/src/view_compiler/compile_pipe.ts index ec02559bb7..ff5a02983f 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_pipe.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_pipe.ts @@ -8,7 +8,6 @@ import {CompilePipeMetadata} from '../compile_metadata'; -import {isBlank} from '../facade/lang'; import {Identifiers, resolveIdentifier, resolveIdentifierToken} from '../identifiers'; import * as o from '../output/output_ast'; @@ -23,7 +22,7 @@ export class CompilePipe { if (meta.pure) { // pure pipes live on the component view pipe = compView.purePipes.get(name); - if (isBlank(pipe)) { + if (!pipe) { pipe = new CompilePipe(compView, meta); compView.purePipes.set(name, pipe); compView.pipes.push(pipe); @@ -85,7 +84,7 @@ function _findPipeMeta(view: CompileView, name: string): CompilePipeMetadata { break; } } - if (isBlank(pipeMeta)) { + if (!pipeMeta) { throw new Error( `Illegal state: Could not find pipe ${name} although the parser should have detected this error!`); } diff --git a/modules/@angular/compiler/src/view_compiler/compile_query.ts b/modules/@angular/compiler/src/view_compiler/compile_query.ts index 0fba9175b3..1bd02aa237 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_query.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_query.ts @@ -8,7 +8,7 @@ import {CompileQueryMetadata} from '../compile_metadata'; import {ListWrapper} from '../facade/collection'; -import {isBlank, isPresent} from '../facade/lang'; +import {isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; @@ -129,7 +129,7 @@ export function createQueryList( export function addQueryToTokenMap(map: Map, query: CompileQuery) { query.meta.selectors.forEach((selector) => { var entry = map.get(selector.reference); - if (isBlank(entry)) { + if (!entry) { entry = []; map.set(selector.reference, entry); } diff --git a/modules/@angular/compiler/src/view_compiler/compile_view.ts b/modules/@angular/compiler/src/view_compiler/compile_view.ts index 5b5b4b1bf2..eab5c45bf3 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_view.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_view.ts @@ -10,7 +10,7 @@ import {AnimationEntryCompileResult} from '../animation/animation_compiler'; import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompilePipeMetadata} from '../compile_metadata'; import {CompilerConfig} from '../config'; import {ListWrapper, MapWrapper} from '../facade/collection'; -import {isBlank, isPresent} from '../facade/lang'; +import {isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; import {ViewType} from '../private_import_core'; @@ -138,7 +138,7 @@ export class CompileView implements NameResolver { } var currView: CompileView = this; var result = currView.locals.get(name); - while (isBlank(result) && isPresent(currView.declarationElement.view)) { + while (!result && isPresent(currView.declarationElement.view)) { currView = currView.declarationElement.view; result = currView.locals.get(name); } diff --git a/modules/@angular/compiler/src/view_compiler/event_binder.ts b/modules/@angular/compiler/src/view_compiler/event_binder.ts index b491c4daa8..9673640f90 100644 --- a/modules/@angular/compiler/src/view_compiler/event_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/event_binder.ts @@ -8,7 +8,7 @@ import {CompileDirectiveMetadata} from '../compile_metadata'; import {StringMapWrapper} from '../facade/collection'; -import {StringWrapper, isBlank, isPresent} from '../facade/lang'; +import {StringWrapper, isPresent} from '../facade/lang'; import {identifierToken} from '../identifiers'; import * as o from '../output/output_ast'; import {BoundEventAst, DirectiveAst} from '../template_parser/template_ast'; @@ -32,7 +32,7 @@ export class CompileEventListener { var listener = targetEventListeners.find( listener => listener.eventTarget == eventTarget && listener.eventName == eventName && listener.eventPhase == eventPhase); - if (isBlank(listener)) { + if (!listener) { listener = new CompileEventListener( compileElement, eventTarget, eventName, eventPhase, targetEventListeners.length); targetEventListeners.push(listener); diff --git a/modules/@angular/compiler/src/view_compiler/property_binder.ts b/modules/@angular/compiler/src/view_compiler/property_binder.ts index 19e5caaaa7..192ec98db2 100644 --- a/modules/@angular/compiler/src/view_compiler/property_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/property_binder.ts @@ -9,7 +9,7 @@ import {SecurityContext} from '@angular/core'; import * as cdAst from '../expression_parser/ast'; -import {isBlank, isPresent} from '../facade/lang'; +import {isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; import {EMPTY_STATE as EMPTY_ANIMATION_STATE, LifecycleHooks, isDefaultChangeDetectionStrategy} from '../private_import_core'; @@ -37,7 +37,7 @@ function bind( method: CompileMethod, bindingIndex: number) { var checkExpression = convertCdExpressionToIr( view, context, parsedExpression, DetectChangesVars.valUnwrapper, bindingIndex); - if (isBlank(checkExpression.expression)) { + if (!checkExpression.expression) { // e.g. an empty expression was given return; } diff --git a/modules/@angular/compiler/src/view_compiler/util.ts b/modules/@angular/compiler/src/view_compiler/util.ts index cb422b6e94..59b66bf26d 100644 --- a/modules/@angular/compiler/src/view_compiler/util.ts +++ b/modules/@angular/compiler/src/view_compiler/util.ts @@ -8,7 +8,7 @@ import {CompileDirectiveMetadata, CompileTokenMetadata} from '../compile_metadata'; -import {isBlank, isPresent} from '../facade/lang'; +import {isPresent} from '../facade/lang'; import {Identifiers, resolveIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; import {createDiTokenExpression} from '../util'; @@ -84,7 +84,7 @@ export function createPureProxy( view.fields.push(new o.ClassField(pureProxyProp.name, null)); var pureProxyId = argCount < Identifiers.pureProxies.length ? Identifiers.pureProxies[argCount] : null; - if (isBlank(pureProxyId)) { + if (!pureProxyId) { throw new Error(`Unsupported number of argument for pure functions: ${argCount}`); } view.createMethod.addStmt(o.THIS_EXPR.prop(pureProxyProp.name) diff --git a/modules/@angular/compiler/test/output/js_emitter_spec.ts b/modules/@angular/compiler/test/output/js_emitter_spec.ts index f293320358..387292a2fb 100644 --- a/modules/@angular/compiler/test/output/js_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/js_emitter_spec.ts @@ -11,8 +11,6 @@ import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter'; import * as o from '@angular/compiler/src/output/output_ast'; import {beforeEach, describe, expect, it} from '@angular/core/testing/testing_internal'; -import {isBlank} from '../../src/facade/lang'; - import {SimpleJsImportGenerator} from './output_emitter_util'; var someModuleUrl = 'asset:somePackage/lib/somePath'; @@ -39,7 +37,7 @@ export function main() { }); function emitStmt(stmt: o.Statement, exportedVars: string[] = null): string { - if (isBlank(exportedVars)) { + if (!exportedVars) { exportedVars = []; } return emitter.emitStatements(someModuleUrl, [stmt], exportedVars); diff --git a/modules/@angular/compiler/test/output/ts_emitter_spec.ts b/modules/@angular/compiler/test/output/ts_emitter_spec.ts index ff3d782af8..e60c3205bb 100644 --- a/modules/@angular/compiler/test/output/ts_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/ts_emitter_spec.ts @@ -11,8 +11,6 @@ import * as o from '@angular/compiler/src/output/output_ast'; import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter'; import {beforeEach, describe, expect, it} from '@angular/core/testing/testing_internal'; -import {isBlank} from '../../src/facade/lang'; - import {SimpleJsImportGenerator} from './output_emitter_util'; var someModuleUrl = 'asset:somePackage/lib/somePath'; @@ -39,7 +37,7 @@ export function main() { }); function emitStmt(stmt: o.Statement, exportedVars: string[] = null): string { - if (isBlank(exportedVars)) { + if (!exportedVars) { exportedVars = []; } return emitter.emitStatements(someModuleUrl, [stmt], exportedVars); diff --git a/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts b/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts index 464358ff8b..23b5a46943 100644 --- a/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts +++ b/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts @@ -722,7 +722,7 @@ class _DuplicateMap { var key = getMapKey(trackById); var recordList = this.map.get(key); - return isBlank(recordList) ? null : recordList.get(trackById, afterIndex); + return recordList ? recordList.get(trackById, afterIndex) : null; } /** diff --git a/modules/@angular/core/src/change_detection/differs/iterable_differs.ts b/modules/@angular/core/src/change_detection/differs/iterable_differs.ts index e2d432ec39..3ac21973e8 100644 --- a/modules/@angular/core/src/change_detection/differs/iterable_differs.ts +++ b/modules/@angular/core/src/change_detection/differs/iterable_differs.ts @@ -8,7 +8,7 @@ import {Optional, Provider, SkipSelf} from '../../di'; import {ListWrapper} from '../../facade/collection'; -import {getTypeNameForDebugging, isBlank, isPresent} from '../../facade/lang'; +import {getTypeNameForDebugging, isPresent} from '../../facade/lang'; import {ChangeDetectorRef} from '../change_detector_ref'; @@ -82,7 +82,7 @@ export class IterableDiffers { return { provide: IterableDiffers, useFactory: (parent: IterableDiffers) => { - if (isBlank(parent)) { + if (!parent) { // Typically would occur when calling IterableDiffers.extend inside of dependencies passed // to // bootstrap(), which would override default pipes instead of extending them. diff --git a/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts b/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts index bfe7e415d2..5188755358 100644 --- a/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts +++ b/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts @@ -8,7 +8,7 @@ import {Optional, Provider, SkipSelf} from '../../di'; import {ListWrapper} from '../../facade/collection'; -import {isBlank, isPresent} from '../../facade/lang'; +import {isPresent} from '../../facade/lang'; import {ChangeDetectorRef} from '../change_detector_ref'; @@ -72,7 +72,7 @@ export class KeyValueDiffers { return { provide: KeyValueDiffers, useFactory: (parent: KeyValueDiffers) => { - if (isBlank(parent)) { + if (!parent) { // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed // to // bootstrap(), which would override default pipes instead of extending them. diff --git a/modules/@angular/core/src/di/reflective_errors.ts b/modules/@angular/core/src/di/reflective_errors.ts index 12da8a9db8..58d9bb6419 100644 --- a/modules/@angular/core/src/di/reflective_errors.ts +++ b/modules/@angular/core/src/di/reflective_errors.ts @@ -8,7 +8,7 @@ import {ListWrapper} from '../facade/collection'; import {BaseError, WrappedError} from '../facade/errors'; -import {isBlank, stringify} from '../facade/lang'; +import {stringify} from '../facade/lang'; import {Type} from '../type'; import {ReflectiveInjector} from './reflective_injector'; @@ -229,7 +229,7 @@ export class NoAnnotationError extends BaseError { var signature: string[] = []; for (var i = 0, ii = params.length; i < ii; i++) { var parameter = params[i]; - if (isBlank(parameter) || parameter.length == 0) { + if (!parameter || parameter.length == 0) { signature.push('?'); } else { signature.push(parameter.map(stringify).join(' ')); diff --git a/modules/@angular/core/src/di/reflective_key.ts b/modules/@angular/core/src/di/reflective_key.ts index 86b7ad4809..f2d4f090b1 100644 --- a/modules/@angular/core/src/di/reflective_key.ts +++ b/modules/@angular/core/src/di/reflective_key.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {isBlank, stringify} from '../facade/lang'; +import {stringify} from '../facade/lang'; import {resolveForwardRef} from './forward_ref'; @@ -32,7 +32,7 @@ export class ReflectiveKey { * Private */ constructor(public token: Object, public id: number) { - if (isBlank(token)) { + if (!token) { throw new Error('Token must be defined!'); } } diff --git a/modules/@angular/core/src/di/reflective_provider.ts b/modules/@angular/core/src/di/reflective_provider.ts index 63435e0fd4..e7bd400aea 100644 --- a/modules/@angular/core/src/di/reflective_provider.ts +++ b/modules/@angular/core/src/di/reflective_provider.ts @@ -201,7 +201,7 @@ function _normalizeProviders(providers: Provider[], res: Provider[]): Provider[] export function constructDependencies( typeOrFunc: any, dependencies: any[]): ReflectiveDependency[] { - if (isBlank(dependencies)) { + if (!dependencies) { return _dependenciesFor(typeOrFunc); } else { var params: any[][] = dependencies.map(t => [t]); @@ -211,7 +211,7 @@ export function constructDependencies( function _dependenciesFor(typeOrFunc: any): ReflectiveDependency[] { var params = reflector.parameters(typeOrFunc); - if (isBlank(params)) return []; + if (!params) return []; if (params.some(isBlank)) { throw new NoAnnotationError(typeOrFunc, params); } diff --git a/modules/@angular/core/src/linker/component_factory.ts b/modules/@angular/core/src/linker/component_factory.ts index 792ce1ee20..9764252e30 100644 --- a/modules/@angular/core/src/linker/component_factory.ts +++ b/modules/@angular/core/src/linker/component_factory.ts @@ -9,7 +9,6 @@ import {ChangeDetectorRef} from '../change_detection/change_detection'; import {Injector} from '../di/injector'; import {unimplemented} from '../facade/errors'; -import {isBlank} from '../facade/lang'; import {Type} from '../type'; import {AppElement} from './element'; import {ElementRef} from './element_ref'; @@ -101,7 +100,7 @@ export class ComponentFactory { injector: Injector, projectableNodes: any[][] = null, rootSelectorOrNode: string|any = null): ComponentRef { var vu: ViewUtils = injector.get(ViewUtils); - if (isBlank(projectableNodes)) { + if (!projectableNodes) { projectableNodes = []; } // Note: Host views don't need a declarationAppElement! diff --git a/modules/@angular/core/src/linker/view_utils.ts b/modules/@angular/core/src/linker/view_utils.ts index c10b575a5a..8780f250e9 100644 --- a/modules/@angular/core/src/linker/view_utils.ts +++ b/modules/@angular/core/src/linker/view_utils.ts @@ -10,7 +10,7 @@ import {APP_ID} from '../application_tokens'; import {devModeEqual} from '../change_detection/change_detection'; import {UNINITIALIZED} from '../change_detection/change_detection_util'; import {Inject, Injectable} from '../di'; -import {isBlank, isPresent, looseIdentical} from '../facade/lang'; +import {isPresent, looseIdentical} from '../facade/lang'; import {ViewEncapsulation} from '../metadata/view'; import {RenderComponentType, Renderer, RootRenderer} from '../render/api'; import {Sanitizer} from '../security'; @@ -72,7 +72,7 @@ const EMPTY_ARR: any[] = []; export function ensureSlotCount(projectableNodes: any[][], expectedSlotCount: number): any[][] { var res: any[][]; - if (isBlank(projectableNodes)) { + if (!projectableNodes) { res = EMPTY_ARR; } else if (projectableNodes.length < expectedSlotCount) { var givenSlotCount = projectableNodes.length; diff --git a/modules/@angular/core/test/change_detection/util.ts b/modules/@angular/core/test/change_detection/util.ts index c190a397ae..5e43c23a94 100644 --- a/modules/@angular/core/test/change_detection/util.ts +++ b/modules/@angular/core/test/change_detection/util.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {isBlank} from '../../src/facade/lang'; + export function iterableChangesAsString( {collection = [] as any, previous = [] as any, additions = [] as any, moves = [] as any, @@ -23,11 +23,11 @@ export function kvChangesAsString( {map, previous, additions, changes, removals}: {map?: any[], previous?: any[], additions?: any[], changes?: any[], removals?: any[]}): string { - if (isBlank(map)) map = []; - if (isBlank(previous)) previous = []; - if (isBlank(additions)) additions = []; - if (isBlank(changes)) changes = []; - if (isBlank(removals)) removals = []; + if (!map) map = []; + if (!previous) previous = []; + if (!additions) additions = []; + if (!changes) changes = []; + if (!removals) removals = []; return 'map: ' + map.join(', ') + '\n' + 'previous: ' + previous.join(', ') + '\n' + diff --git a/modules/@angular/core/test/di/reflective_injector_spec.ts b/modules/@angular/core/test/di/reflective_injector_spec.ts index ca4d4ab9e4..9225720923 100644 --- a/modules/@angular/core/test/di/reflective_injector_spec.ts +++ b/modules/@angular/core/test/di/reflective_injector_spec.ts @@ -11,7 +11,7 @@ import {ReflectiveInjectorDynamicStrategy, ReflectiveInjectorInlineStrategy, Ref import {ResolvedReflectiveProvider_} from '@angular/core/src/di/reflective_provider'; import {expect} from '@angular/platform-browser/testing/matchers'; -import {isBlank, isPresent, stringify} from '../../src/facade/lang'; +import {isPresent, stringify} from '../../src/facade/lang'; class Engine {} @@ -458,7 +458,7 @@ export function main() { it('should resolve and flatten', () => { var providers = ReflectiveInjector.resolve([Engine, [BrokenEngine]]); providers.forEach(function(b) { - if (isBlank(b)) return; // the result is a sparse array + if (!b) return; // the result is a sparse array expect(b instanceof ResolvedReflectiveProvider_).toBe(true); }); }); diff --git a/modules/@angular/forms/src/directives/reactive_directives/form_group_directive.ts b/modules/@angular/forms/src/directives/reactive_directives/form_group_directive.ts index ab41b561fb..d908ababc8 100644 --- a/modules/@angular/forms/src/directives/reactive_directives/form_group_directive.ts +++ b/modules/@angular/forms/src/directives/reactive_directives/form_group_directive.ts @@ -10,7 +10,6 @@ import {Directive, Inject, Input, OnChanges, Optional, Output, Self, SimpleChang import {EventEmitter} from '../../facade/async'; import {ListWrapper} from '../../facade/collection'; -import {isBlank} from '../../facade/lang'; import {FormArray, FormControl, FormGroup} from '../../model'; import {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from '../../validators'; import {ControlContainer} from '../control_container'; @@ -174,7 +173,7 @@ export class FormGroupDirective extends ControlContainer implements Form, } private _checkFormPresent() { - if (isBlank(this.form)) { + if (!this.form) { ReactiveErrors.missingFormException(); } } diff --git a/modules/@angular/forms/src/directives/shared.ts b/modules/@angular/forms/src/directives/shared.ts index b2b8766834..49412ee44d 100644 --- a/modules/@angular/forms/src/directives/shared.ts +++ b/modules/@angular/forms/src/directives/shared.ts @@ -35,8 +35,8 @@ export function controlPath(name: string, parent: ControlContainer): string[] { } export function setUpControl(control: FormControl, dir: NgControl): void { - if (isBlank(control)) _throwError(dir, 'Cannot find control with'); - if (isBlank(dir.valueAccessor)) _throwError(dir, 'No value accessor for form control with'); + if (!control) _throwError(dir, 'Cannot find control with'); + if (!dir.valueAccessor) _throwError(dir, 'No value accessor for form control with'); control.validator = Validators.compose([control.validator, dir.validator]); control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]); @@ -139,7 +139,7 @@ export function isBuiltInAccessor(valueAccessor: ControlValueAccessor): boolean // TODO: vsavkin remove it once https://github.com/angular/angular/issues/3011 is implemented export function selectValueAccessor( dir: NgControl, valueAccessors: ControlValueAccessor[]): ControlValueAccessor { - if (isBlank(valueAccessors)) return null; + if (!valueAccessors) return null; var defaultAccessor: ControlValueAccessor; var builtinAccessor: ControlValueAccessor; diff --git a/modules/@angular/forms/src/validators.ts b/modules/@angular/forms/src/validators.ts index 196a9d4f7f..805bebdbea 100644 --- a/modules/@angular/forms/src/validators.ts +++ b/modules/@angular/forms/src/validators.ts @@ -114,7 +114,7 @@ export class Validators { * of the individual error maps. */ static compose(validators: ValidatorFn[]): ValidatorFn { - if (isBlank(validators)) return null; + if (!validators) return null; var presentValidators = validators.filter(isPresent); if (presentValidators.length == 0) return null; @@ -124,7 +124,7 @@ export class Validators { } static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn { - if (isBlank(validators)) return null; + if (!validators) return null; var presentValidators = validators.filter(isPresent); if (presentValidators.length == 0) return null; diff --git a/modules/@angular/http/src/headers.ts b/modules/@angular/http/src/headers.ts index b3c206038a..9eb16ac31a 100644 --- a/modules/@angular/http/src/headers.ts +++ b/modules/@angular/http/src/headers.ts @@ -7,7 +7,6 @@ */ import {ListWrapper, MapWrapper, StringMapWrapper, isListLikeIterable, iterateListLike} from '../src/facade/collection'; -import {isBlank} from '../src/facade/lang'; /** * Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as @@ -48,7 +47,7 @@ export class Headers { this._headersMap = new Map(); - if (isBlank(headers)) { + if (!headers) { return; } diff --git a/modules/@angular/platform-browser/src/dom/dom_adapter.ts b/modules/@angular/platform-browser/src/dom/dom_adapter.ts index 6d9824420a..ac16c914a5 100644 --- a/modules/@angular/platform-browser/src/dom/dom_adapter.ts +++ b/modules/@angular/platform-browser/src/dom/dom_adapter.ts @@ -8,8 +8,6 @@ import {Type} from '@angular/core'; -import {isBlank} from '../facade/lang'; - var _DOM: DomAdapter = null; export function getDOM() { @@ -21,7 +19,7 @@ export function setDOM(adapter: DomAdapter) { } export function setRootDomAdapter(adapter: DomAdapter) { - if (isBlank(_DOM)) { + if (!_DOM) { _DOM = adapter; } } diff --git a/modules/@angular/platform-browser/src/dom/dom_renderer.ts b/modules/@angular/platform-browser/src/dom/dom_renderer.ts index fed8d631cc..bd5c68d0db 100644 --- a/modules/@angular/platform-browser/src/dom/dom_renderer.ts +++ b/modules/@angular/platform-browser/src/dom/dom_renderer.ts @@ -34,7 +34,7 @@ export abstract class DomRootRenderer implements RootRenderer { renderComponent(componentProto: RenderComponentType): Renderer { var renderer = this.registeredComponents.get(componentProto.id); - if (isBlank(renderer)) { + if (!renderer) { renderer = new DomRenderer(this, componentProto, this.animationDriver); this.registeredComponents.set(componentProto.id, renderer); } diff --git a/modules/@angular/platform-browser/src/dom/events/key_events.ts b/modules/@angular/platform-browser/src/dom/events/key_events.ts index 54cff44bcf..cf72578783 100644 --- a/modules/@angular/platform-browser/src/dom/events/key_events.ts +++ b/modules/@angular/platform-browser/src/dom/events/key_events.ts @@ -8,7 +8,7 @@ import {Injectable, NgZone} from '@angular/core'; -import {ListWrapper, StringMapWrapper} from '../../facade/collection'; +import {ListWrapper} from '../../facade/collection'; import {StringWrapper, isPresent} from '../../facade/lang'; import {getDOM} from '../dom_adapter'; diff --git a/modules/@angular/platform-browser/test/browser_util_spec.ts b/modules/@angular/platform-browser/test/browser_util_spec.ts index e8e217921f..39ef214084 100644 --- a/modules/@angular/platform-browser/test/browser_util_spec.ts +++ b/modules/@angular/platform-browser/test/browser_util_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {StringMapWrapper} from '../src/facade/collection'; + import {BrowserDetection} from '../testing/browser_util'; export function main() { diff --git a/modules/@angular/platform-server/src/parse5_adapter.ts b/modules/@angular/platform-server/src/parse5_adapter.ts index c3cad1fec8..35c4969e39 100644 --- a/modules/@angular/platform-server/src/parse5_adapter.ts +++ b/modules/@angular/platform-server/src/parse5_adapter.ts @@ -135,7 +135,7 @@ export class Parse5DomAdapter extends DomAdapter { } on(el: any /** TODO #9100 */, evt: any /** TODO #9100 */, listener: any /** TODO #9100 */) { var listenersMap: {[k: string]: any} = el._eventListenersMap; - if (isBlank(listenersMap)) { + if (!listenersMap) { var listenersMap: {[k: string]: any} = {}; el._eventListenersMap = listenersMap; } diff --git a/modules/@angular/platform-webworker/src/web_workers/shared/client_message_broker.ts b/modules/@angular/platform-webworker/src/web_workers/shared/client_message_broker.ts index 6eaad1cfa3..f450417d6f 100644 --- a/modules/@angular/platform-webworker/src/web_workers/shared/client_message_broker.ts +++ b/modules/@angular/platform-webworker/src/web_workers/shared/client_message_broker.ts @@ -9,7 +9,6 @@ import {Injectable, Type} from '@angular/core'; import {EventEmitter} from '../../facade/async'; -import {StringMapWrapper} from '../../facade/collection'; import {DateWrapper, StringWrapper, isPresent, print, stringify} from '../../facade/lang'; import {MessageBus} from './message_bus'; diff --git a/modules/@angular/platform-webworker/src/web_workers/worker/renderer.ts b/modules/@angular/platform-webworker/src/web_workers/worker/renderer.ts index 6a66e53970..d55ae476c0 100644 --- a/modules/@angular/platform-webworker/src/web_workers/worker/renderer.ts +++ b/modules/@angular/platform-webworker/src/web_workers/worker/renderer.ts @@ -9,7 +9,7 @@ import {Injectable, RenderComponentType, Renderer, RootRenderer, ViewEncapsulation} from '@angular/core'; import {ListWrapper} from '../../facade/collection'; -import {isBlank, isPresent} from '../../facade/lang'; +import {isPresent} from '../../facade/lang'; import {AnimationKeyframe, AnimationPlayer, AnimationStyles, RenderDebugInfo} from '../../private_import_core'; import {ClientMessageBrokerFactory, FnArg, UiArguments} from '../shared/client_message_broker'; import {MessageBus} from '../shared/message_bus'; @@ -50,7 +50,7 @@ export class WebWorkerRootRenderer implements RootRenderer { renderComponent(componentType: RenderComponentType): Renderer { var result = this._componentRenderers.get(componentType.id); - if (isBlank(result)) { + if (!result) { result = new WebWorkerRenderer(this, componentType); this._componentRenderers.set(componentType.id, result); var id = this._renderStore.allocateId(); @@ -243,11 +243,11 @@ export class NamedEventEmitter { private _listeners: Map; private _getListeners(eventName: string): Function[] { - if (isBlank(this._listeners)) { + if (!this._listeners) { this._listeners = new Map(); } var listeners = this._listeners.get(eventName); - if (isBlank(listeners)) { + if (!listeners) { listeners = []; this._listeners.set(eventName, listeners); }