Skip to content
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

Throw a nice error message when passed null #9

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

CAYdenberg
Copy link
Contributor

Realistically the problem is that if isRGB gets anything other than an array or string, it treats it as an object, and trying to access properties (c.r) on null throws an error.

I shied away from really checking the type; it's possible to pass numbers, etc.. as well as arrays or objects of the wrong shape - execution stays alive but the user might get weird results. It's only null and undefined where a fatal error will occur and it's nice to give the user an indication of why.

@onury onury merged commit d2fecf8 into onury:master Apr 5, 2018
@onury
Copy link
Owner

onury commented Apr 5, 2018

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants