Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Simplified implementation of canUpdate. Fixed canUpdate flagging up when the local version is greater than the store version in development contexts. #77

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

vxern
Copy link
Contributor

@vxern vxern commented Dec 13, 2021

No description provided.

…up when the local version is greater than the store version in development contexts.
// Each consecutive field in the version notation is less significant than the previous one,
// therefore only one comparison needs to yield `true` for it to be determined that the store
// version is greater than the local version.
for (var i = 0; i < store.length; i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a little fragile - sometimes the store and local versions are the same length but not always.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire implementation is pretty naive still, because the semver 2.0 specification specifies that there can also be a build and early release version rc, while this implementation doesn't really take that into account. This pull request is not to serve to implement the whole scope of the specification, but rather improve the previous implementation.

@timtraversy
Copy link
Owner

I should write some tests, because version comparison can be complicated. Lots of edge cases.

@timtraversy timtraversy merged commit 41c82d3 into timtraversy:master Jan 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants