somewhat related to #3

Should be backwards compatible, but as you say in #3, we'll need a lot more tests to be sure. happy to discuss any of the changes or make adjustments.
@sindresorhus mind looking this over? I wasn't sure how you'd want to handle the CLI stuff, so I just updated it to return the same result as before.