monaca-lib
Advanced tools
Comparing version 4.1.8 to 4.1.9
@@ -5,2 +5,7 @@ | ||
v4.1.9 | ||
---- | ||
* Fix getting project name and description from config.xml | ||
v4.1.8 | ||
@@ -7,0 +12,0 @@ ---- |
{ | ||
"name": "monaca-lib", | ||
"version": "4.1.8", | ||
"version": "4.1.9", | ||
"description": "Monaca cloud and localkit API bindings for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "./src/main.js", |
@@ -131,2 +131,34 @@ | ||
// Function to retrieve the value of a specific widget from XML data | ||
const getXmlWidgetValue = (xml, widgetName, defaultValue = '') => { | ||
// Helper function to safely get the first value from an array | ||
const safeGetFirstValue = (values) => { | ||
if (!Array.isArray(values) || values.length === 0) { | ||
return undefined; | ||
} | ||
const firstValue = values[0]; | ||
// If the first element is an object and has the '_' property, return its value | ||
if (firstValue && typeof firstValue === 'object' && '_' in firstValue) { | ||
return firstValue._; | ||
} | ||
return firstValue; | ||
}; | ||
try { | ||
// Check if xml.widget is an object and contains the specified widget name | ||
if (xml.widget && typeof xml.widget === 'object' && widgetName in xml.widget) { | ||
const value = xml.widget[widgetName]; | ||
const extractedValue = safeGetFirstValue(value); | ||
return extractedValue !== undefined ? extractedValue : value; | ||
} | ||
} catch (error) { | ||
console.error(`Error while getting widget value: ${error}`); | ||
} | ||
return typeof defaultValue === 'string' ? defaultValue : ''; | ||
}; | ||
module.exports = { | ||
@@ -150,3 +182,4 @@ filterIgnoreFiles: filterIgnoreFiles, | ||
startSpinner, | ||
sleep | ||
sleep, | ||
getXmlWidgetValue, | ||
}; |
Sorry, the diff of this file is too big to display
Copyleft License
License(Experimental) Copyleft license information was found
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
17864895
68
8865