Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Hau Vo
pleroma-fe
Commits
651c9715
Commit
651c9715
authored
Feb 26, 2019
by
Tae Hoon
Browse files
Use native filter function
parent
a6f2af4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/hocs/with_load_more/with_load_more.js
View file @
651c9715
import
Vue
from
'
vue
'
import
filter
from
'
lodash/filter
'
import
isEmpty
from
'
lodash/isEmpty
'
import
{
getComponentProps
}
from
'
../../services/component_utils/component_utils
'
import
'
./with_load_more.scss
'
...
...
@@ -12,7 +11,7 @@ const withLoadMore = ({
additionalPropNames
=
[]
// additional prop name list of the wrapper component
})
=>
(
WrappedComponent
)
=>
{
const
originalProps
=
Object
.
keys
(
getComponentProps
(
WrappedComponent
))
const
props
=
filter
(
originalProps
,
v
=>
v
!==
childPropName
).
concat
(
additionalPropNames
)
const
props
=
originalProps
.
filter
(
v
=>
v
!==
childPropName
).
concat
(
additionalPropNames
)
return
Vue
.
component
(
'
withLoadMore
'
,
{
render
(
createElement
)
{
...
...
src/hocs/with_subscription/with_subscription.js
View file @
651c9715
import
Vue
from
'
vue
'
import
filter
from
'
lodash/filter
'
import
isEmpty
from
'
lodash/isEmpty
'
import
{
getComponentProps
}
from
'
../../services/component_utils/component_utils
'
import
'
./with_subscription.scss
'
...
...
@@ -11,7 +10,7 @@ const withSubscription = ({
additionalPropNames
=
[]
// additional prop name list of the wrapper component
})
=>
(
WrappedComponent
)
=>
{
const
originalProps
=
Object
.
keys
(
getComponentProps
(
WrappedComponent
))
const
props
=
filter
(
originalProps
,
v
=>
v
!==
childPropName
).
concat
(
additionalPropNames
)
const
props
=
originalProps
.
filter
(
v
=>
v
!==
childPropName
).
concat
(
additionalPropNames
)
return
Vue
.
component
(
'
withSubscription
'
,
{
props
:
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment