mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2024-12-27 12:07:45 +00:00
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
const optsArg = require('./lib/opts-arg.js')
|
|
const pathArg = require('./lib/path-arg.js')
|
|
|
|
const {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js')
|
|
const {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js')
|
|
const {useNative, useNativeSync} = require('./lib/use-native.js')
|
|
|
|
|
|
const mkdirp = (path, opts) => {
|
|
path = pathArg(path)
|
|
opts = optsArg(opts)
|
|
return useNative(opts)
|
|
? mkdirpNative(path, opts)
|
|
: mkdirpManual(path, opts)
|
|
}
|
|
|
|
const mkdirpSync = (path, opts) => {
|
|
path = pathArg(path)
|
|
opts = optsArg(opts)
|
|
return useNativeSync(opts)
|
|
? mkdirpNativeSync(path, opts)
|
|
: mkdirpManualSync(path, opts)
|
|
}
|
|
|
|
mkdirp.sync = mkdirpSync
|
|
mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))
|
|
mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))
|
|
mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))
|
|
mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))
|
|
|
|
module.exports = mkdirp
|