FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
GSTN-Node/node_modules/function-bind/implementation.js at master · letsdev1/GSTN-Node · GitHub
letsdev1
/
GSTN-Node
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
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
GSTN-Node
/
node_modules
/
function-bind
/
implementation.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (44 loc) · 1.43 KB
Breadcrumbs
GSTN-Node
/
node_modules
/
function-bind
/
implementation.js
Copy path
File metadata and controls
52 lines (44 loc) · 1.43 KB
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
'use strict'
;
/* eslint no-invalid-this: 1 */
var
ERROR_MESSAGE
=
'Function.prototype.bind called on incompatible '
;
var
slice
=
Array
.
prototype
.
slice
;
var
toStr
=
Object
.
prototype
.
toString
;
var
funcType
=
'[object Function]'
;
module
.
exports
=
function
bind
(
that
)
{
var
target
=
this
;
if
(
typeof
target
!==
'function'
||
toStr
.
call
(
target
)
!==
funcType
)
{
throw
new
TypeError
(
ERROR_MESSAGE
+
target
)
;
}
var
args
=
slice
.
call
(
arguments
,
1
)
;
var
bound
;
var
binder
=
function
(
)
{
if
(
this
instanceof
bound
)
{
var
result
=
target
.
apply
(
this
,
args
.
concat
(
slice
.
call
(
arguments
)
)
)
;
if
(
Object
(
result
)
===
result
)
{
return
result
;
}
return
this
;
}
else
{
return
target
.
apply
(
that
,
args
.
concat
(
slice
.
call
(
arguments
)
)
)
;
}
}
;
var
boundLength
=
Math
.
max
(
0
,
target
.
length
-
args
.
length
)
;
var
boundArgs
=
[
]
;
for
(
var
i
=
0
;
i
<
boundLength
;
i
++
)
{
boundArgs
.
push
(
'$'
+
i
)
;
}
bound
=
Function
(
'binder'
,
'return function ('
+
boundArgs
.
join
(
','
)
+
'){ return binder.apply(this,arguments); }'
)
(
binder
)
;
if
(
target
.
prototype
)
{
var
Empty
=
function
Empty
(
)
{
}
;
Empty
.
prototype
=
target
.
prototype
;
bound
.
prototype
=
new
Empty
(
)
;
Empty
.
prototype
=
null
;
}
return
bound
;
}
;
Back
|
FazBrowse Home
|
New Git URL