Перейти к файлу
dependabot[bot] fcf4b881f1
Bump micromatch from 4.0.5 to 4.0.8 (#47)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 14:32:48 +02:00
.circleci Update images/orbs used by CircleCI (#42) 2024-03-27 13:40:48 +01:00
.github Add CoC (#8) 2021-04-22 15:53:12 +02:00
src Fix parsing of multi-part versions (#30) 2022-11-03 14:49:05 +01:00
tests Add tests around version numbers resigning (#41) 2024-03-28 12:48:23 +01:00
.gitignore Add Circle CI config (#1) 2021-04-21 21:46:29 +02:00
.npmignore Add *.tgz in .npmignore 2021-04-21 22:18:59 +02:00
.npmrc Add Circle CI config (#1) 2021-04-21 21:46:29 +02:00
.prettierignore Add prettier (#3) 2021-04-21 22:09:45 +02:00
.prettierrc Add prettier (#3) 2021-04-21 22:09:45 +02:00
LICENSE.txt Add LICENSE.txt 2021-04-21 18:44:45 +02:00
README.md Add npm badge on README (#13) 2021-05-04 11:54:18 +02:00
package.json ⬆️ release 1.3.0 2022-11-03 14:53:47 +01:00
yarn.lock Bump micromatch from 4.0.5 to 4.0.8 (#47) 2024-09-02 14:32:48 +02:00

README.md

addons-moz-compare

CircleCI npm version

A JavaScript library to compare Mozilla add-on versions that follow the Manifest Version Format.

API

This library exposes a mozCompare() function that takes two (string) versions A and B and returns:

  • -1 if A < B
  • 0 if A == B
  • 1 if A > B

This implementation matches the Firefox implementation except that there are only 3 different possible return values (Firefox returns strictly negative and strictly positive values instead of -1 and 1).

Usage

npm i addons-moz-compare

or

yarn add addons-moz-compare

Node

const { mozCompare } = require('addons-moz-compare');

Browser

Use window.mozCompare after having included the source of this library.

License

This plugin is released under the Mozilla Public License Version 2.0. See the bundled LICENSE file for details.