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%
Build a utility that manages user configuration objects by extracting, filtering, and transforming their properties and values.
Implement a module that provides functions to analyze and manipulate configuration objects:
Extract configuration keys: Create a function getConfigKeys(config) that returns an array of all configuration property names (own properties only).
Extract configuration values: Create a function getConfigValues(config) that returns an array of all configuration values (own properties only).
Get configuration entries: Create a function getConfigEntries(config) that returns an array of key-value pairs as [key, value] tuples for all own properties.
Filter by value type: Create a function filterByValueType(config, type) that returns an object containing only the properties whose values match the specified JavaScript type string (e.g., 'string', 'number', 'boolean'). Use typeof to check value types.
Get all keys including inherited: Create a function getAllKeys(config) that returns an array of all property names, including inherited properties from the prototype chain.
null, undefined, and empty objects gracefullyGiven {theme: 'dark', fontSize: 14, showNotifications: true}, getConfigKeys returns ['theme', 'fontSize', 'showNotifications'] @test
Given {theme: 'dark', fontSize: 14, showNotifications: true}, getConfigValues returns ['dark', 14, true] @test
Given {theme: 'dark', fontSize: 14}, getConfigEntries returns [['theme', 'dark'], ['fontSize', 14]] @test
Given {theme: 'dark', fontSize: 14, showNotifications: true} and type 'string', filterByValueType returns {theme: 'dark'} @test
Given an object with inherited properties, getAllKeys returns both own and inherited property names @test
@generates
/**
* Returns an array of own enumerable property names.
* @param {Object} config - The configuration object.
* @returns {string[]} Array of property names.
*/
function getConfigKeys(config) {
// IMPLEMENTATION HERE
}
/**
* Returns an array of own enumerable property values.
* @param {Object} config - The configuration object.
* @returns {any[]} Array of property values.
*/
function getConfigValues(config) {
// IMPLEMENTATION HERE
}
/**
* Returns an array of own enumerable key-value pairs.
* @param {Object} config - The configuration object.
* @returns {Array<[string, any]>} Array of [key, value] pairs.
*/
function getConfigEntries(config) {
// IMPLEMENTATION HERE
}
/**
* Filters the configuration object by value type.
* @param {Object} config - The configuration object.
* @param {string} type - The type to filter by (e.g., 'string', 'number', 'boolean').
* @returns {Object} Object containing only properties matching the specified type.
*/
function filterByValueType(config, type) {
// IMPLEMENTATION HERE
}
/**
* Returns an array of all property names, including inherited properties.
* @param {Object} config - The configuration object.
* @returns {string[]} Array of all property names.
*/
function getAllKeys(config) {
// IMPLEMENTATION HERE
}
module.exports = {
getConfigKeys,
getConfigValues,
getConfigEntries,
filterByValueType,
getAllKeys,
};Provides utility functions for working with objects and their properties.