Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose position / location / line internal apis #125

Merged
merged 1 commit into from
Jul 29, 2022

Conversation

DylanPiercey
Copy link
Contributor

@DylanPiercey DylanPiercey commented Jul 29, 2022

Expose some apis for generating position and location information.

Method to get line offset information:
getLines(code: string): string

Method to get a Position object given an offset a line offset array (from getLines):
getPosition(lines: number[], offset: number): Position

Method to get a Location object given a start and end offset and a line offset array (from getLines):
getLocation(lines: number[], startOffset: number, endOffset: number): Location

@changeset-bot
Copy link

changeset-bot bot commented Jul 29, 2022

🦋 Changeset detected

Latest commit: 617d33c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
htmljs-parser Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Jul 29, 2022

Codecov Report

Merging #125 (617d33c) into main (18a377a) will increase coverage by 1.57%.
The diff coverage is 71.42%.

@@            Coverage Diff             @@
##             main     #125      +/-   ##
==========================================
+ Coverage   91.22%   92.79%   +1.57%     
==========================================
  Files          26       26              
  Lines         718      736      +18     
  Branches      224      253      +29     
==========================================
+ Hits          655      683      +28     
+ Misses         39       38       -1     
+ Partials       24       15       -9     
Impacted Files Coverage Δ
src/index.ts 87.50% <ø> (ø)
src/core/Parser.ts 90.42% <50.00%> (+0.53%) ⬆️
src/util/util.ts 85.71% <80.00%> (+0.71%) ⬆️
src/states/JS_COMMENT_LINE.ts 71.42% <0.00%> (-11.91%) ⬇️
src/states/DECLARATION.ts 100.00% <0.00%> (ø)
src/states/HTML_CONTENT.ts 97.61% <0.00%> (+0.11%) ⬆️
src/states/ATTRIBUTE.ts 95.08% <0.00%> (+2.09%) ⬆️
src/states/TAG_NAME.ts 100.00% <0.00%> (+2.27%) ⬆️
src/states/PLACEHOLDER.ts 100.00% <0.00%> (+4.00%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18a377a...617d33c. Read the comment docs.

@DylanPiercey DylanPiercey merged commit 725bcb3 into main Jul 29, 2022
@DylanPiercey DylanPiercey deleted the expose-line-pos-loc-utils branch July 29, 2022 20:40
@github-actions github-actions bot mentioned this pull request Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant