-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat (number) / inRange function (#255)
* Add inRange function * Match with lodash inRange function * Build cdn * Add overloading functions * Build cdn --------- Co-authored-by: Ray Epps <[email protected]>
- Loading branch information
Showing
6 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: inRange | ||
description: Checks if the given number is between two numbers. The starting number is inclusive. The ending number is exclusive. The start and the end of the range can be ascending OR descending order. If end is not specified, it's set to start value. And start is set to 0. | ||
group: Number | ||
--- | ||
|
||
## Basic usage | ||
|
||
Pass the number, the start and the end (optional) of the range. The `_.inRange` function will return true if the given number is in the range. | ||
|
||
```ts | ||
import { inRange } from 'radash' | ||
|
||
inRange(10, 0, 20) // true | ||
inRange(9.99, 0, 10) // true | ||
inRange(Math.PI, 0, 3.15) // true | ||
inRange(10, 10, 20) // true | ||
inRange(10, 0, 10) // false | ||
|
||
inRange(1, 2) // true | ||
inRange(1, 0) // false | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters