mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
Closes: [BS-3524](https://linear.app/affine-design/issue/BS-3524/统一文件大小单位,与-af-一致)   <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Updated file size formatting throughout the app to use a new, consistent utility for displaying file sizes. - Improved clarity and uniformity of file size information in attachments, images, and related notifications. - Enhanced type support to explicitly allow null values for file size descriptions. - **Bug Fixes** - Adjusted file size display in tests to match updated formatting standards. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
10 lines
266 B
TypeScript
10 lines
266 B
TypeScript
export function almostEqual(a: number, b: number, epsilon = 0.0001) {
|
|
return Math.abs(a - b) < epsilon;
|
|
}
|
|
|
|
export function rangeWrap(n: number, min: number, max: number) {
|
|
max = max - min;
|
|
n = (n - min + max) % max;
|
|
return min + (Number.isNaN(n) ? 0 : n);
|
|
}
|