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

Simplify path stripping code #8

Closed
JC3 opened this issue Apr 3, 2022 · 0 comments
Closed

Simplify path stripping code #8

JC3 opened this issue Apr 3, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request minor

Comments

@JC3
Copy link
Owner

JC3 commented Apr 3, 2022

As per todo:

harextract/harextract.html

Lines 175 to 192 in b9a4dc0

// now make a few passes to strip common path prefixes
// todo: code can be simplified by maintaining common components above then
// doing a single second pass to slice + join.
if (harents.length > 0) {
for (var ncommon = 0, allsame = true; allsame && ncommon < harents[0].pathcomps.length; ++ ncommon) {
allsame = true;
let refpart = harents[0].pathcomps[ncommon];
for (ent of harents) {
if (ent.pathcomps[ncommon] != refpart) {
allsame = false;
break;
}
}
}
for (ent of harents) {
ent.path = (ncommon < 0 ? '' : ent.pathcomps.slice(ncommon - 1).join('/'));
}
}

@JC3 JC3 added enhancement New feature or request minor labels Apr 3, 2022
JC3 added a commit that referenced this issue Apr 4, 2022
- #8: simplified and cleaned up path stripping code
- #1: side effect removed unnecessary condition
- #10: side effect removed unnecessary code
@JC3 JC3 closed this as completed Apr 4, 2022
@JC3 JC3 self-assigned this Apr 4, 2022
JC3 added a commit that referenced this issue Apr 4, 2022
0.9.2 feature set:

- [new] update check; quick and painless. displays a button up top if update available (#4)
- [fix] fixed tables not clearing on new file load (#12)
- [fix] displayed filename not in sync with open document (#11)
- [fix] reselecting the same file will now reload it (#13)
- [fix] corrected font size in zip compression level dropdown
- [improve] version and year bump
- [improve] update screenshot although... it's pretty much the same (#7)
- [code] simplified and cleaned up path stripping code (#1, #8, #10)
- [code] slightly more proper html
- [code] split up long jszip line (#5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor
Projects
None yet
Development

No branches or pull requests

1 participant