Skip to content

Commit

Permalink
Use example convention for clamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam-Tait committed Jun 19, 2021
1 parent 68d41b2 commit 26a1d49
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/clamp/index.ts
Expand Up @@ -18,14 +18,12 @@ import requiredArgs from '../_lib/requiredArgs/index'
* Bounds the date
*
* @example
* ```javascript
* const interval = {
* start: new Date(2020, 01, 01),
* end: new Date(2020, 05, 03)
* }
* const date = new Date(2020, 06, 04)
* const clampedDate = clamp(date, interval)
* ```
* // What is Mar, 21, 2021 bounded to an interval starting at Mar, 22, 2021 and ending at Apr, 01, 2021
* const result = clamp(new Date(2021, 2, 21), {
* start: new Date(2021, 2, 22),
* end: new Date(2021, 3, 1),
* })
* //=> Mon Mar 22 2021 00:00:00
*
* @param {Date | Number} date the date to be bounded
* @param {Interval} interval the interval to bound to
Expand Down

0 comments on commit 26a1d49

Please sign in to comment.