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-3/

Data Sanitizer

A utility function that processes arrays of user input data by removing invalid entries and filtering based on specific criteria.

Capabilities

Removes invalid entries from arrays

  • Given an array [1, 0, 2, false, 3, '', 4, null, 5, undefined], returns an array containing only truthy values: [1, 2, 3, 4, 5] @test
  • Given an array [0, false, '', null, undefined, NaN], returns an empty array [] @test
  • Given an array ['hello', '', 'world', null, '!'], returns ['hello', 'world', '!'] @test

Filters arrays by numeric threshold

  • Given an array [10, 5, 20, 15, 8, 25] and threshold 15, returns all values less than the threshold: [10, 5, 8] @test

Removes duplicate entries

  • Given an array [1, 2, 2, 3, 1, 4, 3, 5], returns an array with unique values: [1, 2, 3, 4, 5] @test
  • Given an array of objects [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 1, name: 'Alice'}], returns unique objects based on the id property: [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}] @test

Implementation

@generates

API

/**
 * Removes all falsy values from an array.
 * Falsy values include: false, null, 0, "", undefined, and NaN.
 *
 * @param {Array} array - The array to process.
 * @returns {Array} Returns the new array with falsy values removed.
 */
function removeFalsy(array) {
  // IMPLEMENTATION HERE
}

/**
 * Filters an array to return only values less than the given threshold.
 *
 * @param {Array<number>} array - The array of numbers to filter.
 * @param {number} threshold - The numeric threshold value.
 * @returns {Array<number>} Returns array of numbers less than threshold.
 */
function filterByThreshold(array, threshold) {
  // IMPLEMENTATION HERE
}

/**
 * Removes duplicate values from an array, keeping only unique values.
 *
 * @param {Array} array - The array to process.
 * @returns {Array} Returns the new array with duplicates removed.
 */
function removeDuplicates(array) {
  // IMPLEMENTATION HERE
}

/**
 * Removes duplicate objects from an array based on a specific property.
 *
 * @param {Array<Object>} array - The array of objects to process.
 * @param {string} property - The property name to use for uniqueness comparison.
 * @returns {Array<Object>} Returns the new array with duplicates removed.
 */
function uniqueByProperty(array, property) {
  // IMPLEMENTATION HERE
}

module.exports = {
  removeFalsy,
  filterByThreshold,
  removeDuplicates,
  uniqueByProperty,
};

Dependencies { .dependencies }

lodash { .dependency }

Provides array manipulation utilities for filtering, compacting, and removing duplicates.