Converts HTML entities to their corresponding characters in a string
Overall
score
85%
Evaluation — 85%
↑ 1.39xAgent success when using this tile
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.
Install with Tessl CLI
npx tessl i tessl/npm-lodash-unescapedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10