Skip to content

Commit

Permalink
Use existing isNullOrUndefined function.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdziuban committed Nov 6, 2024
1 parent afdd1a9 commit 5558d68
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/src/legacy/value/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {isNullOrUndefined} from '../../utils';
import {SassColor} from '../../value/color';
import {LegacyValueBase} from './base';

function isUndefinedOrNull<A>(a: A): boolean {
return a === undefined || a === null;
}

export class LegacyColor extends LegacyValueBase<SassColor> {
constructor(red: number, green: number, blue: number, alpha?: number);
constructor(argb: number);
Expand All @@ -26,7 +23,7 @@ export class LegacyColor extends LegacyValueBase<SassColor> {
}

let red: number;
if (isUndefinedOrNull(green) || isUndefinedOrNull(blue)) {
if (isNullOrUndefined(green) || isNullOrUndefined(blue)) {
const argb = redOrArgb as number;
alpha = (argb >> 24) / 0xff;
red = (argb >> 16) % 0x100;
Expand Down

0 comments on commit 5558d68

Please sign in to comment.