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 for processing and organizing product analytics data from an e-commerce platform.
Build a product analytics processing system that organizes product data in different ways for reporting purposes. The system should handle arrays of product objects and provide three different organization methods:
Products are represented as objects with the following properties:
id: Unique product identifier (string)name: Product name (string)category: Product category (string)price: Price in dollars (number)inStock: Stock availability (boolean)Create a function organizeByCategory(products) that groups products by their category. The function should return an object where keys are category names and values are arrays of products in that category.
Create a function createProductIndex(products) that creates a lookup object indexed by product ID. The function should return an object where keys are product IDs and values are the corresponding product objects.
Create a function separateByStock(products) that divides products into two arrays: in-stock and out-of-stock. The function should return an array containing exactly two arrays: [inStockProducts, outOfStockProducts].
inStock: true should be in the first array @testinStock: false should be in the second array @test@generates
/**
* Organizes products by their category.
*
* @param {Array} products - Array of product objects
* @returns {Object} Object with categories as keys and arrays of products as values
*/
function organizeByCategory(products) {
// Implementation
}
/**
* Creates a product lookup index by product ID.
*
* @param {Array} products - Array of product objects
* @returns {Object} Object with product IDs as keys and product objects as values
*/
function createProductIndex(products) {
// Implementation
}
/**
* Separates products into in-stock and out-of-stock groups.
*
* @param {Array} products - Array of product objects
* @returns {Array} Two-element array: [inStockProducts, outOfStockProducts]
*/
function separateByStock(products) {
// Implementation
}
module.exports = {
organizeByCategory,
createProductIndex,
separateByStock
};Provides utility functions for data manipulation and collection operations.