diff options
author | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 22:54:37 +0300 |
---|---|---|
committer | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 22:54:37 +0300 |
commit | 703e03aba33f234712206769f57717ba7d92d23d (patch) | |
tree | 0041f04ccb75bd5379c764e9fe42249fffe75fc3 /node_modules/semver-compare/readme.markdown | |
parent | ab6e257e6e9d9a483d7e86f220d8b209a2cd7753 (diff) | |
download | FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.gz FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.zst |
Added export_allowed file to make repository visible in cgit
Diffstat (limited to 'node_modules/semver-compare/readme.markdown')
-rw-r--r-- | node_modules/semver-compare/readme.markdown | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/node_modules/semver-compare/readme.markdown b/node_modules/semver-compare/readme.markdown new file mode 100644 index 0000000..927a369 --- /dev/null +++ b/node_modules/semver-compare/readme.markdown @@ -0,0 +1,77 @@ +# semver-compare + +compare two semver version strings, returning -1, 0, or 1 + +The return value can be fed straight into `[].sort`. + +[](http://travis-ci.org/substack/semver-compare) + +# example + +``` js +var cmp = require('semver-compare'); +var versions = [ + '1.2.3', + '4.11.6', + '4.2.0', + '1.5.19', + '1.5.5', + '4.1.3', + '2.3.1', + '10.5.5', + '11.3.0' +]; +console.log(versions.sort(cmp).join('\n')); +``` + +prints: + +``` +1.2.3 +1.5.5 +1.5.19 +2.3.1 +4.1.3 +4.2.0 +4.11.6 +10.5.5 +11.3.0 +``` + +whereas the default lexicographic sort (`versions.sort()`) would be: + +``` +1.2.3 +1.5.19 +1.5.5 +10.5.5 +11.3.0 +2.3.1 +4.1.3 +4.11.6 +4.2.0 +``` + +# methods + +``` +var cmp = require('semver-compare') +``` + +## cmp(a, b) + +If the semver string `a` is greater than `b`, return `1`. +If the semver string `b` is greater than `a`, return `-1`. +If `a` equals `b`, return 0; + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install semver-compare +``` + +# license + +MIT |