Skip to content

Commit

Permalink
enzyme-adapter-react-helper: [New] add ifReact
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 22, 2017
1 parent ea73ec1 commit 7256bde
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/enzyme-adapter-react-helper/src/ifReact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import { intersects } from 'semver';

export default function ifReact(range, yes, no) {
if (typeof yes !== 'function') { throw new TypeError('"yes" must be a function'); }
if (typeof no !== 'function') { throw new TypeError('"no" must be a function'); }
return intersects(range, React.version) ? yes : no;
}

0 comments on commit 7256bde

Please sign in to comment.