Package Exports
- path-slashes
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (path-slashes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
path-slashes
Adding or removing of trailing and/or leading slashes in strings, test for their existence or join strings with slashes without duplicating them.
Quick Start
// Check if given path has a leading slash
hasLeadingSlash('/foo'); // => true
hasLeadingSlash('foo'); // => false
// Check if given path has a trailing slash
hasTrailingSlash('foo/'); // => true
hasTrailingSlash('foo'); // => false
// Ensure given path has a leading slash
withLeadingSlash('foo'); // => '/foo'
// Ensure given path has a trailing slash
withTrailingSlash('foo'); // => 'foo/'
// Ensure given path has no leading slash
withoutLeadingSlash('/foo/'); // => 'foo/'
// Ensure given path has no trailing slash
withoutTrailingSlash('/foo/'); // => '/foo'
// Ensure given path has both leading and trailing slashes
withSlashes('foo'); // => '/foo/'
// Ensure given path has neither leading nor trailing slashes
withoutSlashes('/foo/'); // => 'foo'
// Join path parts and add slashes where necessary
slashJoin('foo', 'bar/', '/baz'); // => 'foo/bar/baz'