UNPKG

@stryke/path

Version:

A package containing various utilities that expand the functionality of NodeJs's built-in `path` module

2 lines (1 loc) 610 B
import{lstatSync as n,statSync as e}from"node:fs";import{joinPaths as t}from"./join-paths";import{ABSOLUTE_PATH_REGEX as s}from"./regex";import{slash as i}from"./slash";export function isFile(r,o){return!!e(o?t(o,r):r,{throwIfNoEntry:!1})?.isFile()}export function isDirectory(r,o){return!!e(o?t(o,r):r,{throwIfNoEntry:!1})?.isDirectory()}export const isFileSymlink=(r,o)=>!!n(o?t(o,r):r,{throwIfNoEntry:!1})?.isFile(),isDirectorySymlink=(r,o)=>!!n(o?t(o,r):r,{throwIfNoEntry:!1})?.isDirectory();export function isAbsolutePath(r){return s.test(i(r))}export function isRelativePath(r){return!isAbsolutePath(r)}