Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@mapbox/mapbox-gl-style-spec

Package Overview
Dependencies
Maintainers
14
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/mapbox-gl-style-spec

a specification for mapbox gl styles


Version published
Weekly downloads
127K
decreased by-17.62%
Maintainers
14
Weekly downloads
 
Created

What is @mapbox/mapbox-gl-style-spec?

@mapbox/mapbox-gl-style-spec is a library for working with Mapbox GL style specifications. It allows you to validate, format, and manipulate Mapbox GL styles, which are used to define the visual appearance of maps rendered with Mapbox GL JS.

What are @mapbox/mapbox-gl-style-spec's main functionalities?

Style Validation

This feature allows you to validate a Mapbox GL style JSON object to ensure it conforms to the Mapbox GL style specification. The `validate` function returns an array of errors if the style is invalid.

const validate = require('@mapbox/mapbox-gl-style-spec').validate;
const style = { /* your style JSON here */ };
const errors = validate(style);
if (errors.length) {
  console.error('Style has errors:', errors);
} else {
  console.log('Style is valid!');
}

Style Formatting

This feature allows you to format a Mapbox GL style JSON object to make it more readable. The `format` function returns a formatted version of the style.

const format = require('@mapbox/mapbox-gl-style-spec').format;
const style = { /* your style JSON here */ };
const formattedStyle = format(style);
console.log('Formatted Style:', formattedStyle);

Style Manipulation

This feature allows you to migrate a Mapbox GL style JSON object to the latest version of the style specification. The `migrate` function returns the migrated style.

const migrate = require('@mapbox/mapbox-gl-style-spec').migrate;
const style = { /* your style JSON here */ };
const migratedStyle = migrate(style);
console.log('Migrated Style:', migratedStyle);

Other packages similar to @mapbox/mapbox-gl-style-spec

Keywords

FAQs

Package last updated on 23 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc