-
Notifications
You must be signed in to change notification settings - Fork 32
removes exjs dependency #42
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
removes exjs dependency #42
Conversation
Hey, please see the failing |
const subRanges: IRange[] = topRange.getRanges(); | ||
this._allRanges = this._allRanges.concat(subRanges.en().traverseUnique(range => range.getRanges()).toArray()); | ||
const subRanges: IRange[] = topRange.getRanges(); | ||
this._allRanges = this._allRanges.concat(subRanges); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could reduce it down using something like:
const reducer = (acc, next) => {
acc.push(next);
const nextRanges = next.getRanges();
if (nextRanges.length) {
return nextRanges.reduce(reducer, acc);
}
return acc;
}
and use it like:
const flatRanges = topRange.getRanges.reduce(reducer, [topRange]);
If it needs to be unique, could make it a Set
or a Map
mapped by the id field. (if this is the failing test that you mentioned)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, we need a flat array of unique ranges. Using Set
sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comments here. I've used your approach @stephenwf and pushed that up in
4576dc8.
src/LabelValuePair.ts
Outdated
@@ -27,7 +27,8 @@ namespace Manifesto { | |||
|
|||
public setLabel(value: string): void { | |||
if (this.label && this.label.length) { | |||
var t: Manifesto.Language = this.label.en().where(x => x.locale === this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(this.defaultLocale)).first(); | |||
console.log(this.label); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of console logs made its way in 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that.
Thanks for the great review (and the additional tests added). Is there a way you would like me to resolve the Also I noticed that the uniqueness needed in the added test wasn't caught when just using an |
I've altered the biocrats.js test to check the number of returned ranges. The root range was being included when it didn't have an I've also removed the dist directory, but this doesn't seem to have fixed the conflicts? |
38ec1e9
to
4a0bf85
Compare
I've force pushed a rebase that should handle the |
Cool. Well, the UV seems happy now. Think it's mergeable? |
Part of #41
Though, I'm not sure how much this does in reducing actual bundle size.