CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-safe-stable-stringify

Deterministic and safely JSON.stringify to quickly serialize JavaScript objects

90

1.08x

Evaluation90%

1.08x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-3/

Configuration Logger

A utility that serializes application configuration objects to JSON strings for logging purposes. The utility must handle various JavaScript value types and support custom formatting options.

Capabilities

Basic serialization

  • Serializes a simple object {name: "app", version: 1} to the JSON string '{"name":"app","version":1}' @test
  • Serializes an array [1, 2, 3] to the JSON string '[1,2,3]' @test
  • Serializes nested objects correctly, maintaining structure @test

Custom formatting

  • Uses a replacer function to transform values during serialization @test
  • Uses an array replacer to whitelist specific properties for serialization @test
  • Applies indentation with a space parameter (number) for pretty-printed output @test
  • Applies indentation with a space parameter (string) for custom formatting @test

Implementation

@generates

API

/**
 * Serializes a configuration object to a JSON string.
 *
 * @param {*} value - The value to serialize
 * @param {Function|Array|null} [replacer] - Optional replacer function or array
 * @param {number|string} [space] - Optional spacing for formatting
 * @returns {string} The serialized JSON string
 */
function serializeConfig(value, replacer, space) {
  // IMPLEMENTATION HERE
}

module.exports = { serializeConfig };

Dependencies { .dependencies }

safe-stable-stringify { .dependency }

Provides JSON serialization with safe defaults and compatibility with standard JSON.stringify API.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-safe-stable-stringify

tile.json