main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
740 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { bind, curryN } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Returns the largest integer less than or equal to a given number.
|
---|
| 5 | *
|
---|
| 6 | * Note: floor(null) returns integer 0 and do not give a NaN error.
|
---|
| 7 | *
|
---|
| 8 | * @func floor
|
---|
| 9 | * @memberOf RA
|
---|
| 10 | * @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
|
---|
| 11 | * @category Math
|
---|
| 12 | * @sig Number -> Number
|
---|
| 13 | * @param {number} number The number to floor
|
---|
| 14 | * @return {number} A number representing the largest integer less than or equal to the specified number
|
---|
| 15 | * @example
|
---|
| 16 | *
|
---|
| 17 | * RA.floor(45.95); //=> 45
|
---|
| 18 | * RA.floor(45.05); //=> 45
|
---|
| 19 | * RA.floor(4); //=> 4
|
---|
| 20 | * RA.floor(-45.05); //=> -46
|
---|
| 21 | * RA.floor(-45.95); //=> -46
|
---|
| 22 | * RA.floor(null); //=> 0
|
---|
| 23 | */
|
---|
| 24 |
|
---|
| 25 | const floor = curryN(1, bind(Math.floor, Math));
|
---|
| 26 |
|
---|
| 27 | export default floor;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.