1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 10:54:44 +00:00

feat(monorepo): migrate vue packages and apply oxlint refactors

This commit is contained in:
2026-03-07 18:07:22 +07:00
parent abd6605db3
commit 41d5e18f6b
286 changed files with 10295 additions and 5028 deletions

View File

@@ -1,4 +1,4 @@
import { describe,it, expect } from 'vitest';
import { describe, it, expect } from 'vitest';
import { clamp } from '.';
describe('clamp', () => {
@@ -78,4 +78,4 @@ describe('clamp', () => {
// min and max are -Infinity
expect(clamp(50, -Infinity, -Infinity)).toBe(-Infinity);
});
});
});

View File

@@ -2,7 +2,7 @@
* @name clamp
* @category Math
* @description Clamps a number between a minimum and maximum value
*
*
* @param {number} value The number to clamp
* @param {number} min Minimum value
* @param {number} max Maximum value

View File

@@ -1,5 +1,5 @@
import {describe, it, expect} from 'vitest';
import {inverseLerp, lerp} from '.';
import { describe, it, expect } from 'vitest';
import { inverseLerp, lerp } from '.';
describe('lerp', () => {
it('interpolates between two values', () => {

View File

@@ -1,5 +1,5 @@
import {describe, expect, it} from 'vitest';
import {remap} from '.';
import { describe, expect, it } from 'vitest';
import { remap } from '.';
describe('remap', () => {
it('map values from one range to another', () => {
@@ -43,4 +43,4 @@ describe('remap', () => {
// input range is zero (should return output min)
expect(remap(5, 0, 0, 0, 100)).toBe(0);
});
});
});

View File

@@ -1,11 +1,11 @@
import { clamp } from '../clamp';
import {inverseLerp, lerp} from '../lerp';
import { inverseLerp, lerp } from '../lerp';
/**
* @name remap
* @category Math
* @description Map a value from one range to another
*
*
* @param {number} value The value to map
* @param {number} in_min The minimum value of the input range
* @param {number} in_max The maximum value of the input range
@@ -22,4 +22,4 @@ export function remap(value: number, in_min: number, in_max: number, out_min: nu
const clampedValue = clamp(value, in_min, in_max);
return lerp(out_min, out_max, inverseLerp(in_min, in_max, clampedValue));
}
}

View File

@@ -1,5 +1,5 @@
import {describe, it, expect} from 'vitest';
import {clampBigInt} from '.';
import { describe, it, expect } from 'vitest';
import { clampBigInt } from '.';
describe('clampBigInt', () => {
it('clamp a value within the given range', () => {
@@ -32,4 +32,4 @@ describe('clampBigInt', () => {
// negative range and value
expect(clampBigInt(-10n, -100n, -5n)).toBe(-10n);
});
});
});

View File

@@ -1,5 +1,5 @@
import {minBigInt} from '../minBigInt';
import {maxBigInt} from '../maxBigInt';
import { minBigInt } from '../minBigInt';
import { maxBigInt } from '../maxBigInt';
/**
* @name clampBigInt

View File

@@ -1,5 +1,5 @@
import {describe, it, expect} from 'vitest';
import {inverseLerpBigInt, lerpBigInt} from '.';
import { describe, it, expect } from 'vitest';
import { inverseLerpBigInt, lerpBigInt } from '.';
const MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);

View File

@@ -35,4 +35,4 @@ export function lerpBigInt(start: bigint, end: bigint, t: number) {
*/
export function inverseLerpBigInt(start: bigint, end: bigint, value: bigint) {
return start === end ? 0 : Number((value - start) * SCALE_N / (end - start)) / SCALE;
}
}

View File

@@ -36,4 +36,4 @@ describe('maxBigInt', () => {
const result = maxBigInt(...values);
expect(result).toBe(999n);
});
});
});

View File

@@ -14,4 +14,4 @@ export function maxBigInt(...values: bigint[]) {
throw new TypeError('maxBigInt requires at least one argument');
return values.reduce((acc, val) => val > acc ? val : acc);
}
}

View File

@@ -1,5 +1,5 @@
import {describe, it, expect} from 'vitest';
import {minBigInt} from '.';
import { describe, it, expect } from 'vitest';
import { minBigInt } from '.';
describe('minBigInt', () => {
it('returns Infinity when no values are provided', () => {
@@ -32,8 +32,8 @@ describe('minBigInt', () => {
});
it('handles a large number of bigints', () => {
const values = Array.from({length: 1000}, (_, i) => BigInt(i));
const values = Array.from({ length: 1000 }, (_, i) => BigInt(i));
const result = minBigInt(...values);
expect(result).toBe(0n);
});
});
});

View File

@@ -1,5 +1,5 @@
import {describe, expect, it} from 'vitest';
import {remapBigInt} from '.';
import { describe, expect, it } from 'vitest';
import { remapBigInt } from '.';
describe('remapBigInt', () => {
it('map values from one range to another', () => {
@@ -29,4 +29,4 @@ describe('remapBigInt', () => {
// input range is zero (should return output min)
expect(remapBigInt(5n, 0n, 0n, 0n, 100n)).toBe(0n);
});
});
});

View File

@@ -1,11 +1,11 @@
import { clampBigInt } from '../clampBigInt';
import {inverseLerpBigInt, lerpBigInt} from '../lerpBigInt';
import { inverseLerpBigInt, lerpBigInt } from '../lerpBigInt';
/**
* @name remapBigInt
* @category Math
* @description Map a bigint value from one range to another
*
*
* @param {bigint} value The value to map
* @param {bigint} in_min The minimum value of the input range
* @param {bigint} in_max The maximum value of the input range
@@ -22,4 +22,4 @@ export function remapBigInt(value: bigint, in_min: bigint, in_max: bigint, out_m
const clampedValue = clampBigInt(value, in_min, in_max);
return lerpBigInt(out_min, out_max, inverseLerpBigInt(in_min, in_max, clampedValue));
}
}