1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 19:04:46 +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,7 +1,6 @@
import { describe, it, expect } from 'vitest';
import { and, or, not, has, is, unset, toggle } from '.';
describe('flagsAnd', () => {
it('no effect on zero flags', () => {
const result = and();
@@ -14,7 +13,7 @@ describe('flagsAnd', () => {
expect(result).toBe(0b1010);
});
it('perform bitwise AND operation on flags', () => {
const result = and(0b1111, 0b1010, 0b1100);
@@ -30,15 +29,15 @@ describe('flagsOr', () => {
});
it('source flag is returned if no flags are provided', () => {
const result = or(0b1010);
expect(result).toBe(0b1010);
const result = or(0b1010);
expect(result).toBe(0b1010);
});
it('perform bitwise OR operation on flags', () => {
const result = or(0b1111, 0b1010, 0b1100);
expect(result).toBe(0b1111);
const result = or(0b1111, 0b1010, 0b1100);
expect(result).toBe(0b1111);
});
});
@@ -58,9 +57,9 @@ describe('flagsHas', () => {
});
it('check if a flag has a specific bit unset', () => {
const result = has(0b1010, 0b0100);
expect(result).toBe(false);
const result = has(0b1010, 0b0100);
expect(result).toBe(false);
});
});
@@ -72,9 +71,9 @@ describe('flagsIs', () => {
});
it('check if a flag is unset', () => {
const result = is(0);
expect(result).toBe(false);
const result = is(0);
expect(result).toBe(false);
});
});
@@ -92,4 +91,4 @@ describe('flagsToggle', () => {
expect(result).toBe(0b0010);
});
});
});

View File

@@ -2,7 +2,7 @@
* @name and
* @category Bits
* @description Function to combine multiple flags using the AND operator
*
*
* @param {number[]} flags - The flags to combine
* @returns {number} The combined flags
*
@@ -16,7 +16,7 @@ export function and(...flags: number[]) {
* @name or
* @category Bits
* @description Function to combine multiple flags using the OR operator
*
*
* @param {number[]} flags - The flags to combine
* @returns {number} The combined flags
*
@@ -30,7 +30,7 @@ export function or(...flags: number[]) {
* @name not
* @category Bits
* @description Function to combine multiple flags using the XOR operator
*
*
* @param {number} flag - The flag to apply the NOT operator to
* @returns {number} The result of the NOT operator
*
@@ -44,7 +44,7 @@ export function not(flag: number) {
* @name has
* @category Bits
* @description Function to make sure a flag has a specific bit set
*
*
* @param {number} flag - The flag to check
* @param {number} other - Flag to check
* @returns {boolean} Whether the flag has the bit set
@@ -59,7 +59,7 @@ export function has(flag: number, other: number) {
* @name is
* @category Bits
* @description Function to check if a flag is set
*
*
* @param {number} flag - The flag to check
* @returns {boolean} Whether the flag is set
*
@@ -73,7 +73,7 @@ export function is(flag: number) {
* @name unset
* @category Bits
* @description Function to unset a flag
*
*
* @param {number} flag - Source flag
* @param {number} other - Flag to unset
* @returns {number} The new flag
@@ -88,7 +88,7 @@ export function unset(flag: number, other: number) {
* @name toggle
* @category Bits
* @description Function to toggle (xor) a flag
*
*
* @param {number} flag - Source flag
* @param {number} other - Flag to toggle
* @returns {number} The new flag