Skip to content

Commit

Permalink
Merge branch 'main' into normaliseSequenceDiff
Browse files Browse the repository at this point in the history
  • Loading branch information
ogroppo committed Aug 11, 2024
2 parents 04b4d3c + 6553be2 commit 5afc55f
Show file tree
Hide file tree
Showing 60 changed files with 532 additions and 472 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# deverything

## 1.3.0

### Minor Changes

- randomEmptyValue

## 1.2.0

### Minor Changes

- Add new helpers
- Remove deprecated
- `pretty` is now `stringify`
- `randomNumericId` is now `incrementalId`

## 1.1.0

### Minor Changes

- minor fixes and more helpers

## 1.0.0

### Major Changes

- Breaking changes on args
- percentageChange
- randomInt
- randomPositiveInt
- randomNegativeInt
- randomDate
- randomMaxDate
- checkEnvVars is dropped
- randomPercentage is dropped
- randomPositivePercentage is dropped

## 0.51.1

### Patch Changes

- setUrlSearchParams fix

## 0.51.0

### Minor Changes

- startOfDay

## 0.50.0

### Minor Changes

- dates

## 0.49.0

### Minor Changes

- isStrictlyBetween

## 0.48.1

### Patch Changes
Expand Down
58 changes: 36 additions & 22 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,15 +49,29 @@ 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

### Dates

- `isOver18()`
- `startOfNextMonth()`
- `startOfNextWeek()`
- `startOfThisWeek()`
- `startOfToday()`
- `startOfTomorrow()`

### Math

- `average()`
- `isBetween()`
- `isOutside()`
- `isStrictlyBetween()`
- `max()`
- `min()`
- `multiply()`
- `normaliseArray()`
- `normaliseNumber()`
- `percentageChange()`
- `sum()`

Expand All @@ -67,10 +81,11 @@ Contributions always welcome!
- `arrayDiff()` get the difference of two arrays
- `arrayIntersection()` get the intersection of two arrays
- `capitalize()` word => Word
- `cleanSpaces()` trims and turns double spaces into single space
- `clamp()` clamp number in a range
- `cleanSpaces()` trims and turns double spaces into single space
- `enumKeys()` enum FRUIT { APPLE, PEAR } => ["APPLE", "PEAR"]
- `enumValues()` enum FRUIT { APPLE = 1, PEAR = 3 } => [1, 3]
- `filterAlphanumeric()` remove non-alphanumeric characters
- `first()` get the first element of an array
- `firstKey()` get the first key of an object
- `firstValue()` get the first value of an object
Expand All @@ -87,21 +102,22 @@ Contributions always welcome!
- `normalizeNumber()` normalizes between 0 and 1
- `objectDiff()` get the difference between two objects
-`parseDate()` pass anything Date-Like, and get a JS Date back
- `pretty()` stringify anything, without breaking on circular dependencies
- `promiseWithTimeout()` takes a promise, a timeoutMs, and an option error as arguments. Returns a new Promise that either resolves with the value of the input promise or rejects with the provided error or a default error message if the input promise does not resolve or reject within the specified timeoutMs.
- `scrambleText()` replace alpha chars with random chars
- `seriesAll()` executes promises in series, and returns all results
- `setObjectPath()` set a value in an object by path
- `setUrlSearchParams()` set URL search params
- `shuffle()` shuffles elements in an array
- `sleep()` promise-based sleep
- `stringify()` stringify anything, without breaking on circular dependencies
- `toggleArrayValue()` remove/add value in array
- `truncate()` truncate text, does not break emojis
- `uniqueValues()` gets unique values in an array

### Formatters

- `formatCamelCase()`
- `formatCookies()` { cookie1: "1", cookie2: "2" } => "cookie1=1; cookie2=2"
- `formatNumber()` 1000 => "1,000" or "1K" or 0.112 => "11.2%"
- `formatPercentage()` 0.11 => "11%"
- `formatProgress()` => "[2/10]"
Expand All @@ -112,8 +128,9 @@ 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()`
- `randomArray()`
-`randomArrayItem()` now supporting non-uniform distribution
- `randomBankAccount()`
- `randomBool()`
Expand All @@ -140,31 +157,28 @@ These functions are optimized for low entropy random data generation useful for
- `randomHtmlColorName()`
- `randomIBAN()`
- `randomInt()`
- `randomPositiveInt()` > 0
- `randomNegativeInt()` < 0
- `randomMaxSafeInt()` Range of very BIG integers, which are still safe to use tho
- `randomBigInt()`
- `randomMaxInt()` Range within the Maximum integer supported by js
- `randomMaxSafeInt()` Range of very BIG integers, which are still safe to use tho
- `randomNegativeInt()` < 0
- `randomPositiveInt()` > 0
- `randomIP()`
- `randomName()`
- `randomFirstName()`
- `randomLastName()`
- `randomFullName()`
- `randomNumericCode()`
- `randomObject()`
- `randomParagraph()`
- `randomPassword()`
- `randomPath()` /path/to/something
- `randomPhoneNumber()`
- `randomString()`
- `randomSymbol()`
- `randomUUID()` lightweight uuid generation, passing UUID validation
- `randomValue()`
- `randomWord()`

### Checks

Checks are functions that throw an error, if the validation fails

-`checkEnvVars()` Make sure env vars are set per-environment

### TypeScript Helpers & Generics

- `Coords`
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deverything",
"version": "0.48.1",
"version": "1.3.0",
"description": "Everything you need for Dev",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -17,7 +17,7 @@
"lint": "TIMING=1 eslint src --fix",
"prepublish": "pnpm test && pnpm build",
"test": "jest",
"bump": "pnpm changeset && pnpm changeset version"
"release": "pnpm changeset && pnpm changeset version"
},
"repository": {
"type": "git",
Expand All @@ -27,9 +27,10 @@
"checks",
"dates",
"fake",
"formatters",
"generator",
"helpers",
"formatters",
"math",
"numbers",
"random",
"testing",
Expand All @@ -53,5 +54,6 @@
"ts-node": "^10.9.2",
"tsup": "^6.7.0",
"typescript": "^4.9.5"
}
},
"packageManager": "[email protected]+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a"
}
99 changes: 0 additions & 99 deletions src/checks/checkEnvVars.test.ts

This file was deleted.

Loading

0 comments on commit 5afc55f

Please sign in to comment.