Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/lodash.unescape@4.0.x
tile.json

tessl/npm-lodash-unescape

tessl install tessl/npm-lodash-unescape@4.0.0

Converts HTML entities to their corresponding characters in a string

Agent Success

Agent success rate when using this tile

85%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.39x

Baseline

Agent success rate without this tile

61%

task.mdevals/scenario-9/

Safe Data Parser

Build a data parser utility that safely processes different data formats without throwing exceptions.

Capabilities

Parse JSON strings

  • Parsing valid JSON string '{"name":"Alice","age":30}' returns the parsed object {name: "Alice", age: 30} @test
  • Parsing invalid JSON string '{bad json}' returns an error object @test
  • Parsing empty string '' returns an error object @test

Parse integers from strings

  • Parsing valid integer string '42' returns the number 42 @test
  • Parsing invalid integer string 'abc' returns NaN @test

Execute string operations safely

  • Executing string method toUpperCase on string 'hello' returns 'HELLO' @test
  • Executing string method toUpperCase on null value returns an error object @test

Implementation

@generates

API

/**
 * Parses a JSON string safely, returning either the parsed value or an error.
 *
 * @param {string} jsonString - The JSON string to parse.
 * @returns {Object|Error} The parsed object or an error object.
 */
function parseJSON(jsonString) {
  // IMPLEMENTATION HERE
}

/**
 * Parses an integer from a string safely, returning either the number or NaN.
 *
 * @param {string} str - The string to parse.
 * @returns {number} The parsed integer or NaN.
 */
function parseInteger(str) {
  // IMPLEMENTATION HERE
}

/**
 * Executes a method on an object safely, returning either the result or an error.
 *
 * @param {*} obj - The object to execute the method on.
 * @param {string} methodName - The name of the method to execute.
 * @param {...*} args - Arguments to pass to the method.
 * @returns {*|Error} The method result or an error object.
 */
function executeMethod(obj, methodName, ...args) {
  // IMPLEMENTATION HERE
}

module.exports = {
  parseJSON,
  parseInteger,
  executeMethod,
};

Dependencies { .dependencies }

lodash { .dependency }

Provides utility functions for safe function execution.

@satisfied-by