isbn3
isbn3 copied to clipboard
Return error message if isbn validation failed
It would be useful to return an error message with details of why isbn validation failed.
That could be nice, but would definitely be a breaking change, unless that behavior is activated by a flag.
This could be an interesting feature. Would u consider a PR with the following logic?
IF input length = 10 AND it != starts with 978|979 AND parse = null >> ERRORELSE IF input length = 13 AND it starts with 978|979 and parse = null >> ERRORELSE IF input length > 13 >> ERRORELSE >> null
so error is thrown only when there is formally ISBN-like input but after the parsing there is a null 883951856 (9 digits) >> null 97888 >> null 978883951856 >> null 9788839518569 >> valid 9788839518568 >> error
Maybe such a feature could be a new function, such as parseStrict, or behind a flag: parse(isbn, { strict: true }). In both case, that would remove the problem of the breaking change.
Another idea: it could also (optionally?) enrich the error with the info gathered by the audit function