Skip to content

Commit

Permalink
Merge pull request #13 from quentin-sommer/feat/removed-deprecated-re…
Browse files Browse the repository at this point in the history
…turnfullParser

Removed deprecated prop returnfullParser
  • Loading branch information
quentin-sommer authored Oct 14, 2018
2 parents 3b536ca + 871e7ba commit 1ccefb3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
14 changes: 1 addition & 13 deletions src/UserAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import availableProps from './availableProps'

const UserAgent = (
{children, returnFullParser, returnfullParser, ...props},
{children, returnFullParser, ...props},
{ua}
) => {
const validProps = Object.keys(props).filter(
Expand All @@ -22,16 +22,6 @@ const UserAgent = (
return null
}
if (funcChildren) {
if (returnfullParser) {
if (process.env.NODE_ENV !== 'production') {
const str =
'@quentin-sommer/react-useragent: You are using the deprecated prop `returnfullParser`.' +
' It will be removed in versions >=2.0.0.' +
' Replace it by the new `returnFullParser` to remove this message'
console.warn(str)
}
return children(ua.parser)
}
if (returnFullParser) {
return children(ua.parser)
}
Expand All @@ -53,13 +43,11 @@ if (process.env.NODE_ENV !== 'production') {
{}
),
returnFullParser: PropTypes.bool,
returnfullParser: PropTypes.bool,
}
}

UserAgent.defaultProps = {
returnFullParser: false,
returnfullParser: PropTypes.bool,
}

UserAgent.contextTypes = {
Expand Down
14 changes: 0 additions & 14 deletions tests/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,4 @@ describe('UserAgent', () => {
}
)
})

it('supports deprecated prop `returnfullParser`', () => {
render(
<UserAgentProvider ua={ms10UA}>
<UserAgent returnfullParser>
{parser => parser.getOS().name === 'Windows' && 'windows'}
</UserAgent>
</UserAgentProvider>,
node,
() => {
expect(node.innerHTML).toEqual('windows')
}
)
})
})

0 comments on commit 1ccefb3

Please sign in to comment.