l0bsterssg

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

use-native.js (448B)


      1 const fs = require('fs')
      2 
      3 const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
      4 const versArr = version.replace(/^v/, '').split('.')
      5 const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
      6 
      7 const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
      8 const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
      9 
     10 module.exports = {useNative, useNativeSync}