Function: changeExt()
ts
function changeExt(path, extension): string;Replaces the extension of a path.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | The source path. |
extension | string | The new extension, with or without a leading dot. |
Returns
string
The path with the replaced extension.
Example
ts
changeExt('foo.ts', '.js')
// => 'foo.js'Since
1.0.0