UNPKG
es-abstract
Version:
latest (1.24.0)
next (1.23.2)
1.24.0
1.23.10
1.23.9
1.23.8
1.23.7
1.23.6
1.23.5
1.23.4
1.23.3
1.23.2
1.23.1
1.23.0
1.22.5
1.22.4
1.22.3
1.22.2
1.22.1
1.22.0
1.21.3
1.21.2
1.21.1
1.21.0
1.20.5
1.20.4
1.20.3
1.20.2
1.20.1
1.20.0
1.19.5
1.19.4
1.19.3
1.19.2
1.19.1
1.19.0
1.18.7
1.18.6
1.18.5
1.18.4
1.18.3
1.18.2
1.18.1
1.18.0
1.18.0-next.3
1.18.0-next.2
1.18.0-next.1
1.18.0-next.0
1.17.7
1.17.6
1.17.5
1.17.4
1.17.3
1.17.2
1.17.1
1.17.0
1.17.0-next.1
1.17.0-next.0
1.16.3
1.16.2
1.16.1
1.16.0
1.15.0
1.14.2
1.14.1
1.13.0
1.12.0
1.11.0
1.10.0
1.9.0
1.8.2
1.8.1
1.8.0
1.7.0
1.6.1
1.6.0
1.5.1
1.5.0
1.4.3
1.4.2
1.4.1
1.4.0
1.3.2
1.3.1
1.3.0
1.2.2
1.2.1
1.2.0
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
ECMAScript spec abstract operations.
github.com/ljharb/es-abstract
ljharb/es-abstract
es-abstract
/
2020
/
abs.js
10 lines
(6 loc)
•
217 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
'use strict'
;
var
$abs =
require
(
'math-intrinsics/abs'
);
// https://262.ecma-international.org/11.0/#eqn-abs
module
.
exports
=
function
abs
(
x
) {
return
typeof
x ===
'bigint'
?
BigInt
($abs(
Number
(x))) : $abs(x); };