source: trip-planner-front/node_modules/semver/internal/identifiers.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 409 bytes
Line 
1const numeric = /^[0-9]+$/
2const compareIdentifiers = (a, b) => {
3 const anum = numeric.test(a)
4 const bnum = numeric.test(b)
5
6 if (anum && bnum) {
7 a = +a
8 b = +b
9 }
10
11 return a === b ? 0
12 : (anum && !bnum) ? -1
13 : (bnum && !anum) ? 1
14 : a < b ? -1
15 : 1
16}
17
18const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
19
20module.exports = {
21 compareIdentifiers,
22 rcompareIdentifiers
23}
Note: See TracBrowser for help on using the repository browser.