Skip to content

Commit 47802de

Browse files
authored
Merge pull request #4 from Zearin/develop/misc
docs,fix: Mostly JSDoc tweaks; update deprecated `substr()` to `substring()`.
2 parents bb49365 + 39f612a commit 47802de

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/TemplatePath.js

+18-16
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ TemplatePath.getWorkingDir = function () {
1414
* Returns the directory portion of a path.
1515
* Works for directory and file paths and paths ending in a glob pattern.
1616
*
17-
* @param {String} path A path
17+
* @param {String} path - A path
1818
* @returns {String} the directory portion of a path.
1919
*/
2020
TemplatePath.getDir = function (path) {
@@ -33,8 +33,8 @@ TemplatePath.getDir = function (path) {
3333
*
3434
* [1]: https://nodejs.org/api/path.html#path_path_parse_path
3535
*
36-
* @param {String} path A path
3736
* @returns {String} the directory portion of a path.
37+
* @param {String} filePath - A path
3838
*/
3939
TemplatePath.getDirFromFilePath = function (filePath) {
4040
return path.parse(filePath).dir || ".";
@@ -47,7 +47,7 @@ TemplatePath.getDirFromFilePath = function (filePath) {
4747
*
4848
* [1]: https://nodejs.org/api/path.html#path_path_parse_path
4949
*
50-
* @param {String} path A path
50+
* @param {String} path - A path
5151
* @returns {String} the last path segment in a path
5252
*/
5353
TemplatePath.getLastPathSegment = function (path) {
@@ -62,7 +62,7 @@ TemplatePath.getLastPathSegment = function (path) {
6262
};
6363

6464
/**
65-
* @param {String} path A path
65+
* @param {String} path - A path
6666
* @returns {String[]} an array of paths pointing to each path segment of the
6767
* provided `path`.
6868
*/
@@ -88,7 +88,7 @@ TemplatePath.getAllDirs = function (path) {
8888
*
8989
* [1]: https://nodejs.org/api/path.html#path_path_normalize_path
9090
*
91-
* @param {String} thePath The path that should be normalized.
91+
* @param {String} thePath - The path that should be normalized.
9292
* @returns {String} the normalized path.
9393
*/
9494
TemplatePath.normalize = function (thePath) {
@@ -106,7 +106,7 @@ TemplatePath.normalize = function (thePath) {
106106
*
107107
* [1]: https://nodejs.org/api/path.html#path_path_join_paths
108108
*
109-
* @param {String[]} paths An arbitrary amount of path segments.
109+
* @param {...String} paths - An arbitrary amount of path segments.
110110
* @returns {String} the normalized and joined path.
111111
*/
112112
TemplatePath.join = function (...paths) {
@@ -118,7 +118,7 @@ TemplatePath.join = function (...paths) {
118118
* Maintains a single trailing slash if the last URL path argument
119119
* had at least one.
120120
*
121-
* @param {String[]} urlPaths
121+
* @param {...String} urlPaths
122122
* @returns {String} a normalized URL path described by the given URL path segments.
123123
*/
124124
TemplatePath.normalizeUrlPath = function (...urlPaths) {
@@ -130,7 +130,7 @@ TemplatePath.normalizeUrlPath = function (...urlPaths) {
130130
* Joins the given path segments. Since the first path is absolute,
131131
* the resulting path will be absolute as well.
132132
*
133-
* @param {String[]} paths
133+
* @param {...String} paths
134134
* @returns {String} the absolute path described by the given path segments.
135135
*/
136136
TemplatePath.absolutePath = function (...paths) {
@@ -182,7 +182,7 @@ TemplatePath.addLeadingDotSlashArray = function (paths) {
182182
/**
183183
* Adds a leading dot-slash segment to `path`.
184184
*
185-
* @param {String} path
185+
* @param {String} pathArg
186186
* @returns {String}
187187
*/
188188
TemplatePath.addLeadingDotSlash = function (pathArg) {
@@ -214,8 +214,8 @@ TemplatePath.stripLeadingDotSlash = function (path) {
214214
/**
215215
* Determines whether a path starts with a given sub path.
216216
*
217-
* @param {String} path A path
218-
* @param {String} subPath A path
217+
* @param {String} path - A path
218+
* @param {String} subPath - A path
219219
* @returns {Boolean} whether `path` starts with `subPath`.
220220
*/
221221
TemplatePath.startsWithSubPath = function (path, subPath) {
@@ -229,8 +229,8 @@ TemplatePath.startsWithSubPath = function (path, subPath) {
229229
* Removes the `subPath` at the start of `path` if present
230230
* and returns the remainding path.
231231
*
232-
* @param {String} path A path
233-
* @param {String} subPath A path
232+
* @param {String} path - A path
233+
* @param {String} subPath - A path
234234
* @returns {String} the `path` without `subPath` at the start of it.
235235
*/
236236
TemplatePath.stripLeadingSubPath = function (path, subPath) {
@@ -245,15 +245,15 @@ TemplatePath.stripLeadingSubPath = function (path, subPath) {
245245
};
246246

247247
/**
248-
* @param {String} path A path
248+
* @param {String} path - A path
249249
* @returns {Boolean} whether `path` points to an existing directory.
250250
*/
251251
TemplatePath.isDirectorySync = function (path) {
252252
return fs.existsSync(path) && fs.statSync(path).isDirectory();
253253
};
254254

255255
/**
256-
* @param {String} path A path
256+
* @param {String} path - A path
257257
* @returns {Boolean} whether `path` points to an existing directory.
258258
*/
259259
TemplatePath.isDirectory = async function (path) {
@@ -327,7 +327,7 @@ TemplatePath.getExtension = function (thePath) {
327327
* Removes the extension from a path.
328328
*
329329
* @param {String} path
330-
* @param {String} extension
330+
* @param {String} [extension]
331331
* @returns {String}
332332
*/
333333
TemplatePath.removeExtension = function (path, extension = undefined) {
@@ -349,6 +349,7 @@ TemplatePath.removeExtension = function (path, extension = undefined) {
349349
* e.g. `./my/dir/` stays `./my/dir/` on *nix and becomes `.\\my\\dir\\` on Windows
350350
*
351351
* @param {String} filePath
352+
* @param {String} [sep="/"]
352353
* @returns {String} a file path with the correct local directory separator.
353354
*/
354355
TemplatePath.normalizeOperatingSystemFilePath = function (filePath, sep = "/") {
@@ -361,6 +362,7 @@ TemplatePath.normalizeOperatingSystemFilePath = function (filePath, sep = "/") {
361362
* e.g. `./my/dir/` stays `./my/dir/` on *nix and becomes `.\\my\\dir\\` on Windows
362363
*
363364
* @param {String} filePath
365+
* @param {String} [sep="/"]
364366
* @returns {String} a file path with the correct local directory separator.
365367
*/
366368
TemplatePath.standardizeFilePath = function (filePath, sep = "/") {

0 commit comments

Comments
 (0)