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

Commit 7d185c3

Browse files
authored
fix(add): Specify 'en' locale to String.localeCompare (#3)
No test added, since there's nothing in this module that particularly depends on string sorting, but it's a best practice all the same. Re: npm/cli#2829
1 parent 43b1c07 commit 7d185c3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/cache-install-dir.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const cacheInstallDir = ({ cache, packages }) => {
1212

1313
const getHash = (packages) =>
1414
crypto.createHash('sha512')
15-
.update(packages.sort((a, b) => a.localeCompare(b)).join('\n'))
15+
.update(packages.sort((a, b) => a.localeCompare(b, 'en')).join('\n'))
1616
.digest('hex')
1717
.slice(0, 16)
1818

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const exec = async (opts) => {
143143
},
144144
}))
145145
.map(mani => mani._from)
146-
.sort((a, b) => a.localeCompare(b))
146+
.sort((a, b) => a.localeCompare(b, 'en'))
147147

148148
// no need to install if already present
149149
if (add.length) {

0 commit comments

Comments
 (0)