FCF 2.0 development in progress...
> > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

fcf.normalizeSubpath() function

string fcf.normalizeSubpath(string a_path)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Normalizes the relative subpath. Removes paths ./ and performs an offset ../ inside the relative path. Changes the multiple use of the character / (/////) to the single use (/).

Arguments

string a_path
- Source path
Result
string
- Normalized path

Example: Function application

{ let result = fcf.normalizeSubpath("directory/../../file.txt"); console.log(result); } { let result = fcf.normalizeSubpath("directory/./file.txt"); console.log(result); } { let result = fcf.normalizeSubpath("directory/////////file.txt"); console.log(result); }

Output:

file.txt directory/file.txt directory/file.txt