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:
1.3 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports.signPonyfill = exports["default"] = void 0;
|
---|
5 | var _ramda = require("ramda");
|
---|
6 | var _isFunction = _interopRequireDefault(require("./isFunction"));
|
---|
7 | var _Math = _interopRequireDefault(require("./internal/ponyfills/Math.sign"));
|
---|
8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
9 | var signPonyfill = (0, _ramda.curryN)(1, _Math["default"]);
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Returns the sign of a number, indicating whether the number is positive, negative or zero.
|
---|
13 | *
|
---|
14 | * @func sign
|
---|
15 | * @memberOf RA
|
---|
16 | * @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
|
---|
17 | * @category Math
|
---|
18 | * @sig Number | String -> Number
|
---|
19 | * @param {number} number A number
|
---|
20 | * @return {number} A number representing the sign of the given argument. If the argument is a positive number, negative number, positive zero or negative zero, the function will return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned
|
---|
21 | * @example
|
---|
22 | *
|
---|
23 | * RA.sign(3); // 1
|
---|
24 | * RA.sign(-3); // -1
|
---|
25 | * RA.sign('-3'); // -1
|
---|
26 | * RA.sign(0); // 0
|
---|
27 | * RA.sign(-0); // -0
|
---|
28 | * RA.sign(NaN); // NaN
|
---|
29 | * RA.sign('foo'); // NaN
|
---|
30 | */
|
---|
31 | exports.signPonyfill = signPonyfill;
|
---|
32 | var sign = (0, _isFunction["default"])(Math.sign) ? (0, _ramda.curryN)(1, (0, _ramda.bind)(Math.sign, Math)) : signPonyfill;
|
---|
33 | var _default = sign;
|
---|
34 | exports["default"] = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.