normalize-unicode.js 405 B

1234567891011
  1. // warning: extremely hot code path.
  2. // This has been meticulously optimized for use
  3. // within npm install on large package trees.
  4. // Do not edit without careful benchmarking.
  5. const normalizeCache = Object.create(null)
  6. const {hasOwnProperty} = Object.prototype
  7. module.exports = s => {
  8. if (!hasOwnProperty.call(normalizeCache, s))
  9. normalizeCache[s] = s.normalize('NFKD')
  10. return normalizeCache[s]
  11. }