or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-5/

Configuration File Parser

Build a configuration file parser for a cross-platform mobile app that reads Apple plist XML configuration files and extracts structured data for use in the application.

Requirements

Your task is to implement a configuration parser that:

  1. Reads XML plist files and converts them to JavaScript objects
  2. Extracts specific configuration values from the parsed data
  3. Handles various data types including strings, numbers, booleans, dates, and nested structures
  4. Validates that required configuration fields are present

Implementation

@generates

API

/**
 * Parses an XML plist configuration file and returns a JavaScript object.
 *
 * @param {string} xmlContent - The XML plist content as a string
 * @returns {Object} The parsed configuration object
 * @throws {Error} If the XML is malformed or invalid
 */
function parseConfig(xmlContent) {
  // IMPLEMENTATION HERE
}

/**
 * Extracts a specific configuration value from a parsed config object.
 *
 * @param {Object} config - The parsed configuration object
 * @param {string} key - The configuration key to extract
 * @returns {*} The value associated with the key, or undefined if not found
 */
function getConfigValue(config, key) {
  // IMPLEMENTATION HERE
}

module.exports = {
  parseConfig,
  getConfigValue
};

Test Cases

  • It parses a simple XML plist with string values @test
  • It parses XML plist with multiple data types (string, integer, boolean) @test
  • It parses XML plist with nested dictionaries @test
  • It extracts values from parsed configuration @test

Dependencies { .dependencies }

plist { .dependency }

Provides XML plist parsing capabilities for converting Apple property list files to JavaScript objects.