Skip to content

[Implement] isBuffer<T>(value: T)#8

Merged
jtenner merged 8 commits intomasterfrom
isbuffer
Jul 23, 2019
Merged

[Implement] isBuffer<T>(value: T)#8
jtenner merged 8 commits intomasterfrom
isbuffer

Conversation

@jtenner
Copy link
Copy Markdown
Contributor

@jtenner jtenner commented Jul 19, 2019

This should be all set.

@jtenner jtenner added the enhancement New feature or request label Jul 19, 2019
@jtenner jtenner requested a review from dcodeIO July 19, 2019 20:03
@jtenner jtenner self-assigned this Jul 19, 2019
@jtenner
Copy link
Copy Markdown
Contributor Author

jtenner commented Jul 21, 2019

@dcodeIO

> Buffer.isBuffer(null)
false

We need to do a null check, right?

@dcodeIO
Copy link
Copy Markdown
Member

dcodeIO commented Jul 21, 2019

The instanceof operator should handle this if T is nullable.

@jtenner
Copy link
Copy Markdown
Contributor Author

jtenner commented Jul 22, 2019

Alright. Then this should be all set

@jtenner
Copy link
Copy Markdown
Contributor Author

jtenner commented Jul 22, 2019

Given that it's possible for T to be nullable, maybe this check is still okay? Unless if T is nullable it generates a null check too.

@dcodeIO
Copy link
Copy Markdown
Member

dcodeIO commented Jul 22, 2019

If T is statically nullable, the instanceof will implicitly test for null.

@jtenner
Copy link
Copy Markdown
Contributor Author

jtenner commented Jul 22, 2019

In that case we should be good. Will merge later.

@jtenner jtenner merged commit 22e7456 into master Jul 23, 2019
@dcodeIO dcodeIO deleted the isbuffer branch June 1, 2021 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants