JSPM

locale-compare

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 101
  • Score
    100M100P100Q81702F
  • License MIT

Locale-aware string comparison with Intl.Collator and localeCompare fallback

Package Exports

  • locale-compare
  • locale-compare/src/locale-compare.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (locale-compare) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

locale-compare

Build Status

npm

Locale-aware string comparison with Intl.Collator and localeCompare fallback.

Usage

// ES6 Modules (Babel)

import localeCompare from "locale-compare";

const compare = localeCompare();
const compareInSwedish = localeCompare("sv");

// CommonJS (Node.js):

var compare = require("locale-compare")();
var compareInSwedish = require("locale-compare")("sv");

// Use with Array.sort

["ä", "z"].sort(compare);
["ä", "z"].sort(compareInSwedish);

License

MIT