index.js 450 B

1234567891011121314151617
  1. const url = require('url')
  2. const node = require('../node.js')
  3. const polyfill = require('./polyfill.js')
  4. const useNative = node.satisfies('>=10.12.0')
  5. const fileURLToPath = (path) => {
  6. // the polyfill is tested separately from this module, no need to hack
  7. // process.version to try to trigger it just for coverage
  8. // istanbul ignore next
  9. return useNative
  10. ? url.fileURLToPath(path)
  11. : polyfill(path)
  12. }
  13. module.exports = fileURLToPath