You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

use-native.js 448B

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