tessl install tessl/npm-lodash-unescape@4.0.0Converts 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%
A utility function that processes arrays of user input data by removing invalid entries and filtering based on specific criteria.
[1, 0, 2, false, 3, '', 4, null, 5, undefined], returns an array containing only truthy values: [1, 2, 3, 4, 5] @test[0, false, '', null, undefined, NaN], returns an empty array [] @test['hello', '', 'world', null, '!'], returns ['hello', 'world', '!'] @test[10, 5, 20, 15, 8, 25] and threshold 15, returns all values less than the threshold: [10, 5, 8] @test[1, 2, 2, 3, 1, 4, 3, 5], returns an array with unique values: [1, 2, 3, 4, 5] @test[{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@generates
/**
* 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,
};Provides array manipulation utilities for filtering, compacting, and removing duplicates.