FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript/archive/code/node_modules/es-abstract/5/ToNumber.js at main · iu5git/JavaScript · GitHub
iu5git
/
JavaScript
Public
Notifications
You must be signed in to change notification settings
Fork
21
Star
52
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScript
/
archive
/
code
/
node_modules
/
es-abstract
/
5
/
ToNumber.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
20 lines (15 loc) · 783 Bytes
Breadcrumbs
JavaScript
/
archive
/
code
/
node_modules
/
es-abstract
/
5
/
ToNumber.js
Copy path
File metadata and controls
executable file
·
20 lines (15 loc) · 783 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict'
;
var
ToPrimitive
=
require
(
'./ToPrimitive'
)
;
// http://262.ecma-international.org/5.1/#sec-9.3
module
.
exports
=
function
ToNumber
(
value
)
{
var
prim
=
ToPrimitive
(
value
,
Number
)
;
if
(
typeof
prim
!==
'string'
)
{
return
+
prim
;
// eslint-disable-line no-implicit-coercion
}
// eslint-disable-next-line no-control-regex
var
trimmed
=
prim
.
replace
(
/
^
[
\t
\x0b
\f
\xa0
\ufeff
\n
\r
\u2028
\u2029
\u1680
\u180e
\u2000
\u2001
\u2002
\u2003
\u2004
\u2005
\u2006
\u2007
\u2008
\u2009
\u200a
\u202f
\u205f
\u3000
\u0085
]
+
|
[
\t
\x0b
\f
\xa0
\ufeff
\n
\r
\u2028
\u2029
\u1680
\u180e
\u2000
\u2001
\u2002
\u2003
\u2004
\u2005
\u2006
\u2007
\u2008
\u2009
\u200a
\u202f
\u205f
\u3000
\u0085
]
+
$
/
g
,
''
)
;
if
(
(
/
^
0
[
o
b
]
|
^
[
+
-
]
0
x
/
)
.
test
(
trimmed
)
)
{
return
NaN
;
}
return
+
trimmed
;
// eslint-disable-line no-implicit-coercion
}
;
Back
|
FazBrowse Home
|
New Git URL