Repository navigation
Add Buffer#includes() #3552
Copy link
Copy link
Closed
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Oct 27, 2015 TypedArray#includes and Array#includes are not shipped in V8 yet.
When it happens, buffers will have the method. You can test it with theharmonyflag:% node -v v5.0.0-rc.1 % node --harmony > var buffer = new Buffer(1).fill(1) undefined > buffer.includes(1) true
- addedbufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
on Oct 27, 2015 Though we might want to override it. v8's implementation (following the spec) is restrictive and slow. e.g.
indexOf(),fill(). Instead, to have feature parity with current Buffer API's we should consider our own impl that accepts multi-char strings, etc.@trevnorris good point! Then we can just wrap it around
indexOf.Oh yeah. Good call. Easy PR for the taking.
I made a polyfill: https://github.com/sindresorhus/buffer-includes
- addedgood first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
on Oct 28, 2015 Just added a PR to implement this.
PR is #3567
- added a commit that references this issue
on Dec 16, 2015 - added a commit that references this issue
on Apr 2, 2016 - added a commit that references this issue
on Jul 27, 2026
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
For convenience, code clarity, and parity with
TypedArray. SeeTypedArray#includes().