mozilla / mozilla/source-map

`originalPositionFor(generatedPosition)` fails on string positions

Open
#109 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
JavaScript
Stars
3.7k
Forks
370
PR merge metrics
No merged PRs in 30d

Description

I was sending in strings instead of numbers to the originalPositionFor function. This works unless the strings aren't exactly in the mappings. E.g. originalPositionFor({line:"8", column:"10"}) would work if the sourcemap contained that exact entry, but if it instead contained line 8, column 8 and line 8 column 12, it wouldn't find the sourcemap.

Please mention that line and column MUST be number (not strings) in the readme documentation.

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

Open the README documentation and find the description of originalPositionFor(generatedPosition). Update it to state that line and column must be numbers rather than strings, using the reported string-position example to clarify the requirement. Done means the README explicitly documents the expected numeric types.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.