mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix: color and font comparers
This commit is contained in:
@@ -94,6 +94,12 @@ export class Color implements definition.Color {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static equals(value1: definition.Color, value2: definition.Color): boolean {
|
public static equals(value1: definition.Color, value2: definition.Color): boolean {
|
||||||
|
// both values are falsy
|
||||||
|
if (!value1 && !value2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only one is falsy
|
||||||
if (!value1 || !value2) {
|
if (!value1 || !value2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,16 @@ export class Font implements definitios.Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static equals(value1: Font, value2: Font): boolean {
|
public static equals(value1: Font, value2: Font): boolean {
|
||||||
|
// both values are falsy
|
||||||
|
if (!value1 && !value2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only one is falsy
|
||||||
|
if (!value1 || !value2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return value1.fontFamily === value2.fontFamily &&
|
return value1.fontFamily === value2.fontFamily &&
|
||||||
value1.fontSize === value2.fontSize &&
|
value1.fontSize === value2.fontSize &&
|
||||||
value1.fontStyle === value2.fontStyle &&
|
value1.fontStyle === value2.fontStyle &&
|
||||||
|
|||||||
Reference in New Issue
Block a user