Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rename-extension

electerious1.3kMIT4.0.0

Changes the the extension of a given filename or path

file, rename, name, ext, extension, change, name, path

readme

rename-extension

Travis Build Status Coverage Status Dependencies Greenkeeper badge

A function that changes the the extension of a given filename or path.

Install

npm install rename-extension

Usage

const renameExtension = require('rename-extension')

renameExtension('a/b/c.js', null) // a/b/c
renameExtension('a/b/c.js', '.css') // a/b/c.css
renameExtension('a/b/c.min.js', '.css') // a/b/c.min.css
renameExtension('a/b/.npmrc', null) // a/b/.npmrc
renameExtension('a/b/.npmrc', '.json') // a/b/.npmrc.json

API

Parameters

  • filePath {String} Path to a file.
  • newExt {String} New extension for the file.

Returns

  • filePath {String} Path ending with the new extension.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[4.0.0] - 2020-03-20

Changed

  • Updated dependencies
  • Only support Node.js 10+
  • Test with Node.js 10 and 12

[3.0.0] - 2018-10-28

Changed

  • Drop support for Node.js versions older than version 8

[2.0.4] - 2018-08-25

Changed

  • Removed prepublish script from package.json

[2.0.3] - 2017-08-08

Added

  • Added a changelog

Changed

  • Ignore yarn.lock and package-lock.json files