mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
chore(packages): move dom types down
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* so we may treat them specifically as unequal if they are not a) both arrays
|
||||
* or b) don't contain the same (shallowly compared) elements.
|
||||
*/
|
||||
export function shallowEqual(objA: any, objB: any): boolean {
|
||||
export function shallowEqual(objA: object, objB: object): boolean {
|
||||
// Using Object.is as a first pass, as it covers a lot of the "simple" cases that are
|
||||
// more complex than strict equality and is a built-in. For discussion, see, e.g.:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#description
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
/**
|
||||
* Checks if a value is a valid number (not NaN, null, undefined, or Infinity)
|
||||
*/
|
||||
function isValidNumber(value: unknown): value is number {
|
||||
return typeof value === 'number' && isFinite(value);
|
||||
return typeof value === 'number' && Number.isFinite(value);
|
||||
}
|
||||
|
||||
const UnitLabels = [
|
||||
@@ -29,7 +28,7 @@ function toTimeUnitPhrase(timeUnitValue: number, unitIndex: number): string {
|
||||
|
||||
/**
|
||||
* Converts numeric seconds into a human-readable phrase for accessibility.
|
||||
*
|
||||
*
|
||||
* @param seconds - A (positive or negative) time, represented as seconds
|
||||
* @returns The time, represented as a phrase of hours, minutes, and seconds
|
||||
*
|
||||
@@ -96,7 +95,7 @@ export function formatTime(seconds: number, guide?: number): string {
|
||||
const gh = guide ? Math.floor(guide / 3600) : 0;
|
||||
|
||||
// Handle invalid times
|
||||
if (isNaN(seconds) || seconds === Infinity) {
|
||||
if (Number.isNaN(seconds) || seconds === Infinity) {
|
||||
// '-' is false for all relational operators (e.g. <, >=) so this setting
|
||||
// will add the minimum number of fields specified by the guide
|
||||
h = m = s = '0';
|
||||
@@ -118,7 +117,7 @@ export function formatTime(seconds: number, guide?: number): string {
|
||||
|
||||
/**
|
||||
* Formats a time value with fallback handling for invalid values.
|
||||
*
|
||||
*
|
||||
* @param time - The time value to format in seconds (duration, currentTime, etc.)
|
||||
* @param guide - Optional guide time for consistent formatting
|
||||
* @param fallback - Fallback text when time is invalid (default: "--:--")
|
||||
|
||||
Reference in New Issue
Block a user