New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rewrite-ext

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rewrite-ext

Automatically re-write the destination extension of a filepath based on the source extension. e.g `.coffee` => `.js`. This will only rename the ext, no other path parts are modified.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.7K
decreased by-15.94%
Maintainers
1
Weekly downloads
 
Created
Source

rewrite-ext NPM version

Automatically re-write the destination extension of a filepath based on the source extension. e.g .coffee => .js. This will only rename the ext, no other path parts are modified.

Install with npm

npm i rewrite-ext --save

Running tests

Install dev dependencies.

npm i -d && npm test

Usage

var rewrite = require('rewrite-ext');
rewrite('abc.coffee');
//=> 'abc.js'
rewrite('abc.less');
//=> 'abc.css'

Explicitly pass an extension to use:

rewrite('./faux.js', '.foo');
//=> 'faux.foo'

More examples

rewrite('abc.styl');
//=> 'abc.css'
rewrite('abc.sass');
//=> 'abc.css'
rewrite('abc.scss');
//=> 'abc.css'
rewrite('abc.swig');
//=> 'abc.html'
rewrite('abc.hbs');
//=> 'abc.html'
rewrite('abc.md');
//=> 'abc.html'
rewrite('abc.tmpl');
//=> 'abc.html'
rewrite('./faux.js', '.bar');
//=> 'faux.bar'
rewrite('faux.js');
//=> 'faux.js'
rewrite('faux.css');
//=> 'faux.css'
rewrite('faux.html');
//=> 'faux.html'

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the license


This file was generated by verb on February 22, 2015.

Keywords

FAQs

Package last updated on 22 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc