Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

guard against locale-specific sorting #280

Merged
merged 4 commits into from
May 10, 2021
Merged

Commits on May 10, 2021

  1. json-stringify-nice@1.1.4

    isaacs committed May 10, 2021
    Configuration menu
    Copy the full SHA
    40505a0 View commit details
    Browse the repository at this point in the history
  2. tcompare@5.0.6

    isaacs committed May 10, 2021
    Configuration menu
    Copy the full SHA
    b8c08c8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    589a765 View commit details
    Browse the repository at this point in the history
  4. guard against locale-specific sorting

    Node will use the current environment's locale sorting for
    String.localeCompare.  Thankfully, String.localeCompare can take a
    second argument to specify the locale.  Up until Node 13, any valid
    argument provided to the function _may_ be respected if Node was
    compiled with Intl support, or would always be treated as `'en'`
    otherwise.
    
    The solution is to always set the locale to `'en'`.  An alternative
    solution would be to compare strings based on byte order, but this does
    not provide ideal ergonomis.
    
    To verify this, the locale is set in the test environment to `'sk'`,
    which has a significantly different alphabet, including sorting words
    starting with `'ch'` _after_ words starting with `'d'`.
    
    Re: npm/cli#2829
    Fix: #276
    isaacs committed May 10, 2021
    Configuration menu
    Copy the full SHA
    a843eea View commit details
    Browse the repository at this point in the history