* returns the extension of the path, from the last occurrence of the . (period) * character to end of string in the last portion of the path. * If there is no . in the last portion of the path, or if there are no . characters * other than the first character of the basename of path (see path.b
(path)
| 43 | * @param {string} path |
| 44 | */ |
| 45 | extname(path) { |
| 46 | const filename = path.split("/").slice(-1)[0]; |
| 47 | if (/.+\..*$/.test(filename)) { |
| 48 | return /(?:\.([^.]*))?$/.exec(filename)[0] || ""; |
| 49 | } |
| 50 | |
| 51 | return ""; |
| 52 | }, |
| 53 | |
| 54 | /** |
| 55 | * returns a path string from an object. |