remove spread syntax

This commit is contained in:
Devin Howard 2016-08-05 09:32:16 +08:00
parent 2274155801
commit 980fca9844
2 changed files with 12 additions and 1 deletions

View file

@ -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
}

View 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
}