Socket
Socket
Sign inDemoInstall

@putout/operator-rename-files

Package Overview
Dependencies
388
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/operator-rename-files

🐊Putout operator adds ability to rename files to plugins


Version published
Maintainers
1
Created

Readme

Source

@putout/operator-rename-files NPM version

🐊Putout operator adds ability to rename files to plugins.

Install

npm i putout @putout/operator-rename-files

API

If you want to create 🐊Putout plugin that will rename files according to your needs just use for ESM:

const {operator} = require('putout');
const {renameFiles} = operator;

module.exports = renameFiles({
    type: 'module',
    mask: '*.mjs',
    rename(name) {
        return name.replace(/mjs$/, 'js');
    },
});

And for CommonJS:

module.exports = renameFiles({
    type: 'commonjs',
    mask: '*.cjs',
    rename(name) {
        return name.replace(/cjs$/, 'js');
    },
});

When you do not need to check type field of package.json, avoid type field:

module.exports = renameFiles({
    mask: '*.cjs',
    rename(name) {
        return name.replace(/cjs$/, 'js');
    },
});

You can also use redlint directly.

License

MIT

Keywords

FAQs

Last updated on 07 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc