Skip to content

Commit

Permalink
fix: removed unecessary string match
Browse files Browse the repository at this point in the history
  • Loading branch information
thebiltheory committed May 1, 2020
1 parent 4c4f1c3 commit e4d3dc2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useBreakpoints from 'usebreakpoints'
const App = () => {
const breakpoints = [576, 768, 992, 1200]

const stringBreakpoints = ['576px', '768px', '992px', '1200px']
const stringBreakpoints = ['576px', '768lol', '992px', '1200px']

const [value, breakpoint] = useBreakpoints([1, 2, 3, 4], breakpoints)

Expand Down
4 changes: 1 addition & 3 deletions src/utils/isValidUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export default function isValidUnit(breakpoint: string) {
const unit: string[] = breakpoint.match(/(\D+)/g) || ['']

if (!units.includes(unit[0])) {
throw new Error(
`"${breakpoint.match(/[^0-9]+/g)}" is not a valid CSS unit.`
)
throw new Error(`"${unit}" is not a valid CSS unit.`)
}

return true
Expand Down

0 comments on commit e4d3dc2

Please sign in to comment.