Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
methods.push(...methods.map(name => `${name}Sync`))
methods.push(...methods.map(name => `${name}Async`))
const selected = pick(fsx, methods)
selected.findUpAsync = findUp
selected.findUp = findUp
selected.findUpSync = findUp.sync
selected.existingSync = (...paths) => paths.filter(fsx.existsSync)
selected.existingAsync = selected.existing = (...paths) =>
Promise.all(paths.map(p => fsx.existsAsync(p).then(r => r && p))).then(results =>
results.filter(p => p)
)
const mime = require('mime')
const mimeTypes = mime.types || mime._types
selected.mimeTypes = () => mimeTypes
selected.mimeType = ext => mimeTypes[ext.replace('.', '')]
return selected
}