Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
A node.js and browser JavaScript client to Mapbox services.
Generally Available
$ npm install --save mapbox
Setup:
var MapboxClient = require('mapbox');
var client = new MapboxClient('YOUR_ACCESS_TOKEN');
Basic usage of the geocoder:
client.geocodeForward('Chester, NJ', function(err, data, res) {
// data is the geocoding result as parsed JSON
// res is the http response, including: status, headers and entity properties
});
As an alternative to callbacks, each method also returns a Promise:
client.geocodeForward('Chester, NJ')
.then(function(res) {
// res is the http response, including: status, headers and entity properties
var data = res.entity; // data is the geocoding result as parsed JSON
})
.catch(function(err) {
// handle errors
});
Listing resources may return a subset of the entire listing. If more pages are
available the res
object will contain a .nextPage()
method. This method
requires no arguments, other than an optional callback function, otherwise a
Promise is returned.
Each service is available as a sub-require if you'd only like to include only
its functionality and not the entire bundle. The returned MapboxClient
will have the same constructor style but only include functions necessary
for that service's support.
Available sub-requires:
require('mapbox/lib/services/geocoding')
require('mapbox/lib/services/surface')
require('mapbox/lib/services/matching')
require('mapbox/lib/services/directions')
require('mapbox/lib/services/matrix')
require('mapbox/lib/services/datasets')
require('mapbox/lib/services/styles')
require('mapbox/lib/services/uploads')
require('mapbox/lib/services/tilestats')
require('mapbox/lib/services/static')
require('mapbox/lib/services/tilesets')
require('mapbox/lib/services/tokens')
FAQs
interface to mapbox services
We found that mapbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 44 open source maintainers collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.