aboutsummaryrefslogtreecommitdiff
path: root/node_modules/mkdirp/lib/use-native.js
blob: 079361de19fd81103d2ef19076faa2244509e6d3 (plain)
1
2
3
4
5
6
7
8
9
10
const fs = require('fs')

const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
const versArr = version.replace(/^v/, '').split('.')
const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12

const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync

module.exports = {useNative, useNativeSync}