forked from isaacs/node-tar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: normalize unicode without cache
closes cnpm/cnpmcore#624
- Loading branch information
Showing
2 changed files
with
2 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
// warning: extremely hot code path. | ||
// This has been meticulously optimized for use | ||
// within npm install on large package trees. | ||
// Do not edit without careful benchmarking. | ||
const normalizeCache = Object.create(null) | ||
const { hasOwnProperty } = Object.prototype | ||
module.exports = s => { | ||
if (!hasOwnProperty.call(normalizeCache, s)) { | ||
normalizeCache[s] = s.normalize('NFD') | ||
} | ||
return normalizeCache[s] | ||
return s.normalize('NFD') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters