evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility that fetches product data from an API and applies pricing transformations during the JSON parsing process.
Apply a percentage-based markup to product prices as the JSON data streams in.
Convert prices from one currency to another during JSON parsing.
/**
* Fetches product data from a URL and applies a markup percentage to all prices.
* Returns a promise that resolves with the complete transformed product list.
*
* @param {string} url - The URL to fetch product data from
* @param {number} markupPercent - The markup percentage to apply (e.g., 10 for 10%)
* @returns {Promise<Array>} Promise resolving to array of products with transformed prices
*/
function applyMarkup(url, markupPercent) {
// IMPLEMENTATION HERE
}
/**
* Fetches product data from a URL and converts all prices using the given conversion rate.
* Returns a promise that resolves with the complete transformed product list.
*
* @param {string} url - The URL to fetch product data from
* @param {number} conversionRate - The rate to multiply prices by
* @returns {Promise<Array>} Promise resolving to array of products with converted prices
*/
function convertCurrency(url, conversionRate) {
// IMPLEMENTATION HERE
}
module.exports = {
applyMarkup,
convertCurrency,
};Provides streaming JSON parsing with transformation capabilities.