1.0.4 • Published 2 years ago

vite-plugin-proto-global v1.0.4

Weekly downloads
-
License
Apache License 2....
Repository
github
Last release
2 years ago

vite-plugin-proto-global

Extend JavaScript prototypes globally in your Vite project

Installation

npm i vite-plugin-proto-global -D
# or
yarn add vite-plugin-proto-global -D

Configuration

In your vite.config.js, configure the plugin with the prototypes you want to extend. For example:

// vite.config.js
import { defineConfig } from 'vite'
import { protoGlobalPlugin } from 'vite-plugin-proto-global'

export default defineConfig({
  plugins: [
      protoGlobalPlugin([
          {
              className: 'Array',
              methods: {
                  reverseNumbers: function() {
                    return this.sort((a, b) => b - a);
                },
              },
          },
          // ... other extensions
      ])
  ],
})

Usage

Once the plugin is configured, the extended prototypes can be used globally in your project. For example:

// example.js
const myArray = [1, 2, 3];
myArray.reverseNumbers(); // Use the custom method extended to Array's prototype

Support

If you have any questions or issues with the plugin, please submit an issue on the GitHub repository. Your support is appreciated, and if you find this plugin helpful, consider giving it a star. Thank you!

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago