2017-12-01 14:23:03 -08:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Must use this method for CD (instead of === ) since NaN !== NaN
|
|
|
|
*/
|
|
|
|
export function isDifferent(a: any, b: any): boolean {
|
|
|
|
// NaN is the only value that is not equal to itself so the first
|
|
|
|
// test checks if both a and b are not NaN
|
|
|
|
return !(a !== a && b !== b) && a !== b;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stringify(value: any): string {
|
|
|
|
if (typeof value == 'function') return value.name || value;
|
|
|
|
if (typeof value == 'string') return value;
|
|
|
|
if (value == null) return '';
|
|
|
|
return '' + value;
|
2017-12-13 14:28:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function that throws a "not implemented" error so it's clear certain
|
|
|
|
* behaviors/methods aren't yet ready.
|
|
|
|
*
|
|
|
|
* @returns Not implemented error
|
|
|
|
*/
|
|
|
|
export function notImplemented(): Error {
|
|
|
|
return new Error('NotImplemented');
|
|
|
|
}
|