mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 10:54:44 +00:00
refactor(pacakages/stdlib): add base jsdoc for each function
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
/**
|
||||
* Create a function that generates unique flags
|
||||
* @name flagsGenerator
|
||||
* @category Bits
|
||||
* @description Create a function that generates unique flags
|
||||
*
|
||||
* @returns {Function} A function that generates unique flags
|
||||
* @throws {RangeError} If more than 31 flags are created
|
||||
@@ -20,7 +22,9 @@ export function flagsGenerator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to combine multiple flags using the AND operator
|
||||
* @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
|
||||
@@ -32,7 +36,9 @@ export function and(...flags: number[]) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to combine multiple flags using the OR operator
|
||||
* @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
|
||||
@@ -44,7 +50,9 @@ export function or(...flags: number[]) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to apply the NOT operator to a flag
|
||||
* @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
|
||||
@@ -56,7 +64,9 @@ export function not(flag: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to make sure a flag has a specific bit set
|
||||
* @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
|
||||
@@ -69,7 +79,9 @@ export function has(flag: number, other: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to check if a flag is set
|
||||
* @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
|
||||
@@ -81,7 +93,9 @@ export function is(flag: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to unset a flag
|
||||
* @name unset
|
||||
* @category Bits
|
||||
* @description Function to unset a flag
|
||||
*
|
||||
* @param {number} flag - Source flag
|
||||
* @param {number} other - Flag to unset
|
||||
@@ -94,7 +108,9 @@ export function unset(flag: number, other: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to toggle (xor) a flag
|
||||
* @name toggle
|
||||
* @category Bits
|
||||
* @description Function to toggle (xor) a flag
|
||||
*
|
||||
* @param {number} flag - Source flag
|
||||
* @param {number} other - Flag to toggle
|
||||
|
||||
Reference in New Issue
Block a user