Closed bjornstar closed 1 year ago
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 is
be a function is that we cannot re-export all the named exports as a default export, making them tree-shakable even when using the default export. I wonder if it's worth moving the function to something like is.detect()
. Thoughts?
I have done something similar here: https://github.com/sindresorhus/query-string/blob/main/index.js
One downside of having the default export
is
be a function is that we cannot re-export all the named exports as a default export, making them tree-shakable even when using the default export. I wonder if it's worth moving the function to something likeis.detect()
. Thoughts?
It makes sense to provide access to the original method through a named export. I had been struggling to find a name for it, detect
works for me.
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 detect
.
Nice work 👍
Do you plan more changes or should I release this?
Nice work 👍
Do you plan more changes or should I release this?
I'd like to do the is.any
/ is.all
assertion descriptions.
It would also be nice to include dropping node v14 since this is a breaking change, can I reopen #182?
I'd like to do the is.any / is.all assertion descriptions.
👍
It would also be nice to include https://github.com/sindresorhus/is/pull/182 since this is a breaking change, can I reopen https://github.com/sindresorhus/is/pull/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.