docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a utility that validates configuration data stored in Apple's property list (plist) format, with specific focus on ensuring numeric configuration values are correctly typed as integers.
Your utility should provide two main functions:
The utility must correctly handle integer values throughout the parsing and generation process. Configuration values that are whole numbers should be preserved as integers, not floating-point numbers.
When parsing a plist XML configuration file, your utility should:
When generating a plist XML file from a configuration object, your utility should:
<integer>42</integer>, parsing it returns the number 42 @test{port: 8080}, generating plist XML produces an integer element <integer>8080</integer> @test{count: 5, ratio: 3.14}, the generated XML uses <integer>5</integer> for the whole number and <real>3.14</real> for the decimal @test/**
* Parses a plist XML string and returns the configuration as a JavaScript object.
*
* @param {string} xmlString - The plist XML string to parse
* @returns {Object} The parsed configuration object
*/
function parseConfig(xmlString) {
// IMPLEMENTATION HERE
}
/**
* Generates a plist XML string from a configuration object.
*
* @param {Object} config - The configuration object to convert
* @returns {string} The plist XML string
*/
function generateConfig(config) {
// IMPLEMENTATION HERE
}
module.exports = {
parseConfig,
generateConfig
};Provides Apple property list parsing and building support.