Determine if an object is a Buffer without including the full buffer module
93
Pending
Does it follow best practices?
Impact
93%
1.02xAverage score across 9 eval scenarios
Pending
The risk profile of this skill
Build a validator utility for a data processing pipeline that checks if input values are binary data (Buffer objects) with optimal performance.
You are building a high-throughput data processing system that handles thousands of inputs per second. The system must validate that incoming data is in Buffer format before processing, but this validation is in the critical path and cannot introduce significant overhead.
Create a validation module that:
The validator should:
true when given any type of Buffer (created with Buffer.from(), Buffer.alloc(), etc.)false for all non-Buffer types including null, undefined, strings, numbers, arrays, and plain objects@generates
/**
* Checks if a value is a Buffer with minimal performance overhead.
*
* @param {any} value - The value to check
* @returns {boolean} true if value is a Buffer, false otherwise
*/
function isValidBuffer(value) {
// Implementation here
}
module.exports = isValidBuffer;Provides efficient Buffer type detection
@satisfied-by
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9