Closed Roang-zero1 closed 4 years ago
Hmm, I don’t think they should be the same, otherwise, why use convert? Convert is faster on valid input, precisely because it doesn’t test for invalid input, and that’s its use case
Could be clearer in the docs!
resolved in #13
is and is.convert()() do not have the same behavior.
The function created through convert() do not have the same results as calling is() directly, even when using the same tests.
I've rewritten all tests from is() to convert()() at Roang-zero1/unist-util-is/tree/convert-test. Running these tests failes 14 tests (e.g. for invalid index).
Steps to reproduce
Expected behaviour
From my understanding is() and convert()() should be equivalent.
Actual behaviour
is(node, null, -1) throws and error while
returns undefined.