FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
google-map-react/develop/utils/props2Stream.js at master · Kumar-Ashwin-Hubert/google-map-react · GitHub
Kumar-Ashwin-Hubert
/
google-map-react
Public
forked from
google-map-react/google-map-react
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
google-map-react
/
develop
/
utils
/
props2Stream.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (25 loc) · 879 Bytes
Breadcrumbs
google-map-react
/
develop
/
utils
/
props2Stream.js
Copy path
File metadata and controls
31 lines (25 loc) · 879 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
21
22
23
24
25
26
27
28
29
30
31
import
{
Component
}
from
'react'
;
import
{
BehaviorSubject
}
from
'rxjs/BehaviorSubject'
;
import
'rxjs/add/operator/distinctUntilChanged'
;
import
omit
from
'./omit'
;
import
createHelper
from
'./createHelper'
;
import
createEagerFactory
from
'./createEagerFactory'
;
const
prop2Stream
=
(
propName
,
comparator
=
(
a
,
b
)
=>
a
===
b
)
=>
BaseComponent
=>
{
const
factory
=
createEagerFactory
(
BaseComponent
)
;
return
class
extends
Component
{
props$
=
new
BehaviorSubject
(
this
.
props
[
propName
]
)
.
distinctUntilChanged
(
comparator
)
;
UNSAFE_componentWillReceiveProps
(
nextProps
)
{
this
.
props$
.
next
(
nextProps
[
propName
]
)
;
}
render
(
)
{
return
factory
(
{
...
omit
(
this
.
props
,
[
propName
]
)
,
[
`
${
propName
}
$`
]
:
this
.
props$
,
}
)
;
}
}
;
}
;
export
default
createHelper
(
prop2Stream
,
'prop2Stream'
)
;
Back
|
FazBrowse Home
|
New Git URL