You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <p align="center">
  2. <a href="http://gulpjs.com">
  3. <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  4. </a>
  5. </p>
  6. # replace-ext
  7. [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
  8. Replaces a file extension with another one.
  9. ## Usage
  10. ```js
  11. var replaceExt = require('replace-ext');
  12. var path = '/some/dir/file.js';
  13. var newPath = replaceExt(path, '.coffee');
  14. console.log(newPath); // /some/dir/file.coffee
  15. ```
  16. ## API
  17. ### `replaceExt(path, extension)`
  18. Replaces the extension from `path` with `extension` and returns the updated path string.
  19. Does not replace the extension if `path` is not a string or is empty.
  20. ## replace-ext for enterprise
  21. Available as part of the Tidelift Subscription
  22. The maintainers of replace-ext and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-replace-ext?utm_source=npm-replace-ext&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
  23. ## License
  24. MIT
  25. [downloads-image]: http://img.shields.io/npm/dm/replace-ext.svg
  26. [npm-url]: https://www.npmjs.com/package/replace-ext
  27. [npm-image]: http://img.shields.io/npm/v/replace-ext.svg
  28. [azure-pipelines-url]: https://dev.azure.com/gulpjs/replace-ext/_build/latest?branchName=master
  29. [azure-pipelines-image]: https://dev.azure.com/gulpjs/replace-ext/_apis/build/status/replace-ext?branchName=master
  30. [travis-url]: https://travis-ci.org/gulpjs/replace-ext
  31. [travis-image]: http://img.shields.io/travis/gulpjs/replace-ext.svg?label=travis-ci
  32. [appveyor-url]: https://ci.appveyor.com/project/gulpjs/replace-ext
  33. [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/replace-ext.svg?label=appveyor
  34. [coveralls-url]: https://coveralls.io/r/gulpjs/replace-ext
  35. [coveralls-image]: http://img.shields.io/coveralls/gulpjs/replace-ext/master.svg
  36. [gitter-url]: https://gitter.im/gulpjs/gulp
  37. [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg