How to use the @mapbox/mapbox-gl-style-spec/reference/v8.json function in @mapbox/mapbox-gl-style-spec

To help you get started, we’ve selected a few @mapbox/mapbox-gl-style-spec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stevage / mapbox-gl-utils / make.js View on Github external
/*
Generates the list of paint and layout properties from the Mapbox-GL-JS style spec.
Should be run when new properties are added to that spec.
*/

const v8 = require('@mapbox/mapbox-gl-style-spec/reference/v8.json');
const fs = require('fs');
const out = {
    paints: [],
    layouts: []
};
Object.keys(v8)
    .filter(x => /^paint_/.test(x))
    .forEach(key => out.paints.push(...Object.keys(v8[key])));

Object.keys(v8)
    .filter(x => /^layout_/.test(x))
    .forEach(key => out.layouts.push(...Object.keys(v8[key])));
    
out.paints = Array.from(new Set(out.paints));
out.layouts = Array.from(new Set(out.layouts));
fs.writeFileSync('keys.json', JSON.stringify(out));
github stevage / mapbox-gl-utils / make.js View on Github external
/*
Generates the list of paint and layout properties from the Mapbox-GL-JS style spec.
Should be run when new properties are added to that spec.
*/

const v8 = require('@mapbox/mapbox-gl-style-spec/reference/v8.json');
const fs = require('fs');
const out = {
    paints: [],
    layouts: []
};
Object.keys(v8)
    .filter(x => /^paint_/.test(x))
    .forEach(key => out.paints.push(...Object.keys(v8[key])));

Object.keys(v8)
    .filter(x => /^layout_/.test(x))
    .forEach(key => out.layouts.push(...Object.keys(v8[key])));
    
out.paints = Array.from(new Set(out.paints));
out.layouts = Array.from(new Set(out.layouts));
fs.writeFileSync('keys.json', JSON.stringify(out));