UNPKG

810 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var path = require("path");
4/**
5 * Returns «true» if the last partial of the path starting with a period.
6 */
7function isDotDirectory(filepath) {
8 return path.basename(filepath).startsWith('.');
9}
10exports.isDotDirectory = isDotDirectory;
11/**
12 * Return naive depth of provided filepath.
13 */
14function getDepth(filepath) {
15 return filepath.split('/').length;
16}
17exports.getDepth = getDepth;
18/**
19 * Return resolved a sequence of paths segments into an absolute path.
20 */
21function resolve(from, to) {
22 return path.resolve(from, to);
23}
24exports.resolve = resolve;
25/**
26 * Convert a windows-like path to a unix-style path.
27 */
28function normalize(filepath) {
29 return filepath.replace(/\\/g, '/');
30}
31exports.normalize = normalize;