-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from forcedotcom/sm/pjson-engines-is-minimum
Sm/pjson-engines-is-minimum
- Loading branch information
Showing
3 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2023, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
exports.semverIsLessThan = (version, target) => { | ||
const [major, minor, patch] = version.split('.').map((v) => parseInt(v, 10)); | ||
const [targetMajor, targetMinor, targetPatch] = target.split('.').map((v) => parseInt(v, 10)); | ||
if (major < targetMajor) { | ||
return true; | ||
} | ||
if (major === targetMajor && minor < targetMinor) { | ||
return true; | ||
} | ||
if (major === targetMajor && minor === targetMinor && patch < targetPatch) { | ||
return true; | ||
} | ||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters