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

only define toBuffer if Buffer is defined #172

Merged
merged 2 commits into from
Nov 30, 2017
Merged

only define toBuffer if Buffer is defined #172

merged 2 commits into from
Nov 30, 2017

Conversation

dcousens
Copy link
Contributor

@dcousens dcousens commented Nov 29, 2017

Alternative to having a run-time check?

Error is more legible too, IMHO.

The existing error:

    if (!val) throw new Error(msg || 'Assertion failed');
              ^
Error: Assertion failed

The new

TypeError: mynum.toBuffer is not a function

Copy link
Owner

@indutny indutny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

2 participants