-
Notifications
You must be signed in to change notification settings - Fork 547
Open
Labels
semver:majorbackwards-incompatible breaking changesbackwards-incompatible breaking changes
Milestone
Description
What / Why
I'm trying to compute a bunch of various increments for a specific version (TypeScript):
console.log(version.inc('major'))
console.log(version.inc('minor'))
console.log(version.inc('patch'))The problem is the SemVer class itself is mutable, so each increment is computed against previous increment result. This is not what I need.
So, I need a way to clone this object, like.
console.log(new SemVer(version).inc('major'))
console.log(new SemVer(version).inc('minor'))
console.log(new SemVer(version).inc('patch'))But the constructor of the SemVer (new SemVer(version)) doesn't create a new instance when passed another instance with the same options. So, again, the code doesn't work.
Is there a way to clone a SemVer?
Metadata
Metadata
Assignees
Labels
semver:majorbackwards-incompatible breaking changesbackwards-incompatible breaking changes