@titanium/turbo
Version:
<p align="center"> <img src="https://cdn.secure-api.org/images/turbo-title_400.png" /><br> <a href="https://www.npmjs.com/package/@titanium/turbo"> <img src="https://img.shields.io/npm/v/@titanium/turbo.png" /> </a> </p>
18 lines (16 loc) • 497 B
JavaScript
/**
* Code in this file will attempt to optimize generated code so it's more compact
* and executes faster, better, etc.
*/
var JSON_NULL = JSON.parse('null');
// strips null and undefined values out of Alloy styles
exports.optimizeStyle = function(styleList) {
for (var style in styleList) {
for (var key in styleList[style]) {
var v = styleList[style][key];
if (v == JSON_NULL || typeof(v) === 'undefined' || typeof(v) === 'null') {
delete styleList[style][key];
}
}
}
};