Skip to content

Commit

Permalink
[ADD] jsDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
amomammadw committed Jan 13, 2024
1 parent baf2b71 commit d33d0df
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/flags.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
/**
* @description is the value string or not
* @returns boolean
* @param string your value
* @example isString('mmd')
*/
export const isString = (value: any) => typeof value === "string";

/**
* @description is the value number or not
* @returns boolean
* @param any your value
* @example isNumber(2)
*/
export const isNumber = (value: any) => typeof value === "number";

/**
* @description is the value undefined or not
* @returns boolean
* @param any your value
* @example isUndefined('mmd')
*/
export const isUndefined = (value: any) => typeof value === "undefined";

/**
* @description is the value object or not
* @returns boolean
* @param object your value
* @example isObject({name:'mmd'})
*/
export const isObject = (value: any) => typeof value === "object";

/**
* @description is the value symbol or not
* @returns boolean
* @param symbol your value
* @example isSymbol({name:'mmd'})
*/
export const isSymbol = (value: any) => typeof value === "symbol";
12 changes: 12 additions & 0 deletions src/math.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* @description is the value odd or not
* @returns boolean
* @param number your value
* @example isOdd(31)
*/
export const isOdd = (number: number) => {
if (typeof number === "number") {
return number % 2 !== 0;
Expand All @@ -6,6 +12,12 @@ export const isOdd = (number: number) => {
}
};

/**
* @description is the value even or not
* @returns boolean
* @param number your value
* @example isEven(31)
*/
export const isEven = (number: number) => {
if (typeof number === "number") {
return number % 2 === 0;
Expand Down

0 comments on commit d33d0df

Please sign in to comment.