Sha256: 4890a2816353aec02b4275986521b2efc6281e16f68f6568926d2d53aec14738

Contents?: true

Size: 409 Bytes

Versions: 66

Compression:

Stored size: 409 Bytes

Contents

const numeric = /^[0-9]+$/
const compareIdentifiers = (a, b) => {
  const anum = numeric.test(a)
  const bnum = numeric.test(b)

  if (anum && bnum) {
    a = +a
    b = +b
  }

  return a === b ? 0
    : (anum && !bnum) ? -1
    : (bnum && !anum) ? 1
    : a < b ? -1
    : 1
}

const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)

module.exports = {
  compareIdentifiers,
  rcompareIdentifiers
}

Version data entries

66 entries across 50 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/core-js-compat/node_modules/semver/internal/identifiers.js
optimacms-0.1.61 spec/dummy/node_modules/css-loader/node_modules/semver/internal/identifiers.js
decidim-0.27.1 packages/webpacker/node_modules/semver/internal/identifiers.js
decidim-0.26.4 packages/webpacker/node_modules/semver/internal/identifiers.js
decidim-0.27.0 packages/webpacker/node_modules/semver/internal/identifiers.js
decidim-0.26.3 packages/webpacker/node_modules/semver/internal/identifiers.js
decidim-0.27.0.rc2 packages/webpacker/node_modules/semver/internal/identifiers.js
decidim-0.27.0.rc1 packages/webpacker/node_modules/semver/internal/identifiers.js
appmap-0.72.2 ./node_modules/semver/internal/identifiers.js
appmap-0.72.1 ./node_modules/semver/internal/identifiers.js
appmap-0.72.0 ./node_modules/semver/internal/identifiers.js
appmap-0.71.0 ./node_modules/semver/internal/identifiers.js
disco_app-0.16.1 test/dummy/node_modules/@npmcli/fs/node_modules/semver/internal/identifiers.js
disco_app-0.16.1 test/dummy/node_modules/core-js-compat/node_modules/semver/internal/identifiers.js
disco_app-0.16.1 test/dummy/node_modules/sass-loader/node_modules/semver/internal/identifiers.js
appmap-0.70.2 ./node_modules/semver/internal/identifiers.js
appmap-0.70.1 ./node_modules/semver/internal/identifiers.js
appmap-0.70.0 ./node_modules/semver/internal/identifiers.js
appmap-0.69.0 ./node_modules/semver/internal/identifiers.js
appmap-0.68.2 ./node_modules/semver/internal/identifiers.js