CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-is-buffer

Determine if an object is a Buffer without including the full buffer module

93

1.02x
Quality

Pending

Does it follow best practices?

Impact

93%

1.02x

Average score across 9 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-2/

Input Validator

Build a utility module that validates different types of input data to ensure they meet specific type requirements before processing.

Requirements

Implement a validator that can check if values are Buffer objects. The validator should:

  1. Accept any input value and determine if it is a Buffer
  2. Return a boolean result: true for Buffer objects, false for all other types
  3. Handle all primitive types safely (null, undefined, strings, numbers, booleans)
  4. Handle object types (plain objects, arrays, functions) correctly
  5. Work reliably across different JavaScript environments

Implementation

@generates

Test Cases

Implement tests that verify the validator works correctly:

  • It returns true when passed a Buffer created with Buffer.from() @test
  • It returns true when passed a Buffer created with Buffer.alloc() @test
  • It returns false when passed null @test
  • It returns false when passed undefined @test
  • It returns false when passed a string @test
  • It returns false when passed a number @test
  • It returns false when passed a plain object @test
  • It returns false when passed an array @test

API

/**
 * 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 };

Dependencies { .dependencies }

is-buffer { .dependency }

Provides Buffer type detection functionality.

tile.json