remove spread syntax
This commit is contained in:
parent
2274155801
commit
980fca9844
2 changed files with 12 additions and 1 deletions
|
@ -1,7 +1,9 @@
|
|||
import React, { Component, PropTypes } from 'react'
|
||||
import { objectWithoutProperties } from '../utils'
|
||||
|
||||
const MapLink = props => {
|
||||
const { show, linkText, href, linkClass, ...otherProps } = props
|
||||
const { show, linkText, href, linkClass } = props
|
||||
const otherProps = objectWithoutProperties(props, ['show', 'linkText', 'href', 'linkClass'])
|
||||
if (!show) {
|
||||
return null
|
||||
}
|
||||
|
|
9
frontend/src/utils/index.js
Normal file
9
frontend/src/utils/index.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
export const objectWithoutProperties = (obj, keys) => {
|
||||
const target = {}
|
||||
for (let i in obj) {
|
||||
if (keys.indexOf(i) !== -1) continue
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue
|
||||
target[i] = obj[i]
|
||||
}
|
||||
return target
|
||||
}
|
Loading…
Reference in a new issue