-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement named exports #191
Conversation
This is looking very good. Can you update the readme usage example to also show named import usage? And also maybe mention that using named import can benefit from tree-shaking. |
One downside of having the default export I have done something similar here: https://github.com/sindresorhus/query-string/blob/main/index.js |
Co-authored-by: Sindre Sorhus <[email protected]>
Co-authored-by: Sindre Sorhus <[email protected]>
It makes sense to provide access to the original method through a named export. I had been struggling to find a name for it, I think it would be nice to allow users to continue using the default export, at least for a little bit to give them time to migrate completely to named exports. |
I have updated the readme and exported the default method as |
readme.md
Outdated
|
||
```js | ||
import {assertNull, isUndefined} from '@sindresorhus/is'; | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should go at the end of the Usage
section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I moved it up underneath the Usage section.
Nice work 👍 Do you plan more changes or should I release this? |
I'd like to do the It would also be nice to include dropping node v14 since this is a breaking change, can I reopen #182? |
Resolves #137
I added named exports for every method, both is and assert.
While implementing it, I exported validLength and whitespaceString as they were both used internally but seemed useful.
I also couldn't stop myself from improving the type for isInRange to be
[number, number]
instead ofnumber[]
. I can revert this change if you'd like.I also alphabetized the method and function declarations for easier detection of missing entries.
One nice side effect of this process is that we can remove the method names that were renamed because they were reserved words in typescript. I left them in for backwards compatibility but marked them as deprecated.
I moved the ArrayLike, NodeStream, and Predicate type definitions into the types declaration, they seem to fit in better there. I can move them back if you prefer.