l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

index.js (1029B)


      1 const optsArg = require('./lib/opts-arg.js')
      2 const pathArg = require('./lib/path-arg.js')
      3 
      4 const {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js')
      5 const {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js')
      6 const {useNative, useNativeSync} = require('./lib/use-native.js')
      7 
      8 
      9 const mkdirp = (path, opts) => {
     10   path = pathArg(path)
     11   opts = optsArg(opts)
     12   return useNative(opts)
     13     ? mkdirpNative(path, opts)
     14     : mkdirpManual(path, opts)
     15 }
     16 
     17 const mkdirpSync = (path, opts) => {
     18   path = pathArg(path)
     19   opts = optsArg(opts)
     20   return useNativeSync(opts)
     21     ? mkdirpNativeSync(path, opts)
     22     : mkdirpManualSync(path, opts)
     23 }
     24 
     25 mkdirp.sync = mkdirpSync
     26 mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))
     27 mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))
     28 mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))
     29 mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))
     30 
     31 module.exports = mkdirp