ccc-tnt-psd2ui/npm-packages/win32-v2.4.x/mkdirp/lib/use-native.js

11 lines
448 B
JavaScript
Raw Permalink Normal View History

2023-07-24 02:36:46 +00:00
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}