'use strict';

require('../fs/index.js');
require('../../../universalify/index.js');
var index = require('../../../../_virtual/index21.js');
var index$1 = require('../../../../_virtual/index20.js');

const fs = index$1.__exports;
const u = index.__exports.fromPromise;

async function symlinkType (srcpath, type) {
  if (type) return type

  let stats;
  try {
    stats = await fs.lstat(srcpath);
  } catch {
    return 'file'
  }

  return (stats && stats.isDirectory()) ? 'dir' : 'file'
}

function symlinkTypeSync (srcpath, type) {
  if (type) return type

  let stats;
  try {
    stats = fs.lstatSync(srcpath);
  } catch {
    return 'file'
  }
  return (stats && stats.isDirectory()) ? 'dir' : 'file'
}

var symlinkType_1 = {
  symlinkType: u(symlinkType),
  symlinkTypeSync
};

exports.symlinkType_1 = symlinkType_1;
