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 utility module that validates different types of input data to ensure they meet specific type requirements before processing.
Implement a validator that can check if values are Buffer objects. The validator should:
true for Buffer objects, false for all other types@generates
Implement tests that verify the validator works correctly:
true when passed a Buffer created with Buffer.from() @testtrue when passed a Buffer created with Buffer.alloc() @testfalse when passed null @testfalse when passed undefined @testfalse when passed a string @testfalse when passed a number @testfalse when passed a plain object @testfalse when passed an array @test/**
* Checks if a value is a Buffer object.
*
* @param {any} value - The value to check
* @returns {boolean} True if the value is a Buffer, false otherwise
*/
function isBuffer(value) {
// Implementation
}
module.exports = { isBuffer };Provides Buffer type detection functionality.
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9