Skip to content

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

Merged
jtenner merged 8 commits into
masterfrom
isbuffer
Jul 23, 2019
Merged

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

Conversation

@jtenner

@jtenner jtenner commented Jul 19, 2019

Copy link
Copy Markdown
Contributor

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

jtenner commented Jul 21, 2019

Copy link
Copy Markdown
Contributor Author

@dcodeIO

> Buffer.isBuffer(null)
false

We need to do a null check, right?

@dcodeIO

dcodeIO commented Jul 21, 2019

Copy link
Copy Markdown
Member

The instanceof operator should handle this if T is nullable.

@jtenner

jtenner commented Jul 22, 2019

Copy link
Copy Markdown
Contributor Author

Alright. Then this should be all set

@jtenner

jtenner commented Jul 22, 2019

Copy link
Copy Markdown
Contributor Author

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

dcodeIO commented Jul 22, 2019

Copy link
Copy Markdown
Member

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

@jtenner

jtenner commented Jul 22, 2019

Copy link
Copy Markdown
Contributor Author

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

Comment thread tests/buffer.spec.ts
@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