fcf.normalizeSubpath() function
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
- Source path
Result
- 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