package.src.style-spec.empty.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapbox-gl Show documentation
Show all versions of mapbox-gl Show documentation
A WebGL interactive maps library
The newest version!
import latest from './reference/latest';
export default function emptyStyle() {
const style = {};
const version = latest['$version'];
for (const styleKey in latest['$root']) {
const spec = latest['$root'][styleKey];
if (spec.required) {
let value = null;
if (styleKey === 'version') {
value = version;
} else {
if (spec.type === 'array') {
value = [];
} else {
value = {};
}
}
if (value != null) {
style[styleKey] = value;
}
}
}
return style;
}