dachev / node-cld

Language detection for Javascript (Node). Based on the CLD2 (Compact Language Detector) library from Google.
Apache License 2.0
314 stars 55 forks source link

Safe language detection mode #80

Open kibertoad opened 1 year ago

kibertoad commented 1 year ago

Creating errors is a fairly expensive operation in JavaScript (primarily due to stacktrace generation), and it is not really necessary for conveying the fact that language resolution was not successful. It would be great if there was a support for safeDetection options flag which would not throw if detection is not successful, but merely returned an empty language list.

kibertoad commented 1 year ago

If this proposal is accepted, I can send in a PR!

catalinberta commented 1 year ago

I second this, safeDetection would be good to have