mapbox / mapbox/pbf

A more user-friendly API

Open
#84 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
881
Forks
113
PR merge metrics
No merged PRs in 30d

Description

Is anyone here opposed to maybe adding a more user-friendly API to this library.

Right now it takes a fair amount of boilerplate to do what is essentially `JSON.parse(encoded)` or `JSON.stringify(obj)`.

Plus, there doesn't seem to be a way to get the same objects out on the decode end as were put into the encoding step. This means even more boilerplate code to translate certain fields from numbers into enum strings. Considering this is probably the most common use case it seems worth it to make this a simple one-step call like `buffer = encode(schema, obj)` and `obj = decode(schema, buffer)`. And preferably, the input to encode and the output of decode should have deep equality.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the library's current encode and decode entry points and how they relate to JSON.parse and JSON.stringify. Define the public API and schema behavior needed for one-step calls, including preservation of object values and deep equality between the encoded input and decoded output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.