Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ogroppo committed Jul 5, 2024
1 parent 3002762 commit e57726e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Contributions always welcome!

### Validators

- `isArray()`
- `isBoolean()`
- `isArray()`
- `isBoolean()`
- `isBrowser()` to detect if you are on the browser
- `isBuffer()` if it's a buffer
- `isClient()` same as isBrowser
Expand All @@ -26,20 +26,20 @@ Contributions always welcome!
- `isEmptyArray()` checks if the array has no items
- `isEmptyObject()` checks if the object has no keys
- `isFile()` if it's a file
- `isFunction()`
- `isFunction()`
- `isJsDate()` if it's a **valid** javascript's Date
- `isFutureDate()`
- `isPastDate()`
- `isFutureDate()`
- `isPastDate()`
- `isStringDate()` also checks if the string passed is a **valid** date
- `isKey()` is a real key of an object
- `isLastIndex()` is the index is the last item of array
- `isNotEmptyString()` must have some text, checks for spaces-only
- `isNumber()` if the arg is number, and also usable (no infinity)
- `isInt()` if it's an integer
- `isEven()`
- `isOdd()`
- `isPositiveInt()`
- `isNegativeInt()`
- `isEven()`
- `isOdd()`
- `isPositiveInt()`
- `isNegativeInt()`
- `isNumeric()` if string is representing a number
-`isObject()` if it's a js plain Object
- `isPromise()` if it's a promise
Expand All @@ -49,7 +49,7 @@ Contributions always welcome!
-`isSame()` Compare if dates, functions, arrays, objects or anything else are the same
- `isServer()` if you are on the server
- `isString()`
- `isURL()`
- `isURL()`
- `isUUID()` if it's a valid UUID

### Math
Expand All @@ -58,6 +58,8 @@ Contributions always welcome!
- `max()`
- `min()`
- `multiply()`
- `normaliseArray()`
- `normaliseNumber()`
- `percentageChange()`
- `sum()`

Expand Down Expand Up @@ -112,7 +114,7 @@ Contributions always welcome!

These functions are optimized for low entropy random data generation useful for Unit Testing, Storybook, Pass real validations, Reverse hacking, Penetration testing...

- `randomAddress()`
- `randomAddress()`
- `randomAlphaNumericCode()`
-`randomArrayItem()` now supporting non-uniform distribution
- `randomBankAccount()`
Expand Down
4 changes: 3 additions & 1 deletion src/math/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export * from "./average";
export * from "./isBetween";
export * from "./isOutside";
export * from "./max";
export * from "./min";
export * from "./multiply";
export * from "./isOutside";
export * from "./normaliseArray";
export * from "./normaliseNumber";
export * from "./percentageChange";
export * from "./sum";
4 changes: 4 additions & 0 deletions src/math/normaliseArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { max } from "./max";
import { min } from "./min";
import { normaliseNumber } from "./normaliseNumber";

/**
* Normalises an array of numbers
* @example normaliseArray([1, 2, 3]) => [0, 0.5, 1]
*/
export const normaliseArray = (values: number[]) => {
const minValue = min(values);
const maxValue = max(values);
Expand Down
4 changes: 4 additions & 0 deletions src/math/normaliseNumber.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
*
* @example normaliseNumber(50, 0, 100) => 0.5
*/
export const normaliseNumber = (
value: number,
minValue: number,
Expand Down

0 comments on commit e57726e

Please sign in to comment.