# jquery-pluginify

> Convert plugin class into a jQuery plugin

Latest version **1.0.4** (published 2018-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install jquery-pluginify
pnpm add jquery-pluginify
yarn add jquery-pluginify
bun add jquery-pluginify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-10-18 |
| First published | 2018-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mark Notton |
| Maintainers | marknotton |

## Links

- npm: https://www.npmjs.com/package/jquery-pluginify
- Repository: https://github.com/marknotton/jquery-pluginify
- Issues: https://github.com/marknotton/jquery-pluginify/issues
- npm.io page: https://npm.io/package/jquery-pluginify

## Recent versions

- 1.0.4 (latest) — 2018-10-18
- 1.0.3 — 2018-08-05
- 1.0.2 — 2018-06-04
- 1.0.1-1 — 2018-05-31
- 1.0.1 — 2018-05-31
- 1.0.0-1 — 2018-05-28
- 1.0.0 — 2018-05-28

## README

# jQuery Pluginify

Convert plugin class into a jQuery plugin

### Installation

```
npm i jquery-pluginify --save
```

### Requires
ES6 Support


### Options
| Name      | Type   | Description |
|-----------|--------|-------------|
| name      | string | Plugin name reference
| classname | object | Class reference
| iterate   | bool   | Defaults to true.
|           | | **True** - Defines a class for every instance of the elements found.
|           | | **False** - Defines the class just once, and passes all element instances through to the class.
| shorthand | bool   | Defaults to false. Generate a shorthand as $.name
| ignoreWarning | bool | Defaults to false. Set to `true` if you want to ignore the fact the jQuery isn't found at the time of calling this function.

### Example

```js
class myClass {
  constructor(elements, ...settings) {
    // console.log(elements, settings);
  }
}
```
Define default settings to apply to all instances of the class
```js
myClass.settings = {};
```

Define settings like this:
```js
pluginify('myPlugin', myClass, false, true);
```
Or like this (in any order):
```js
pluginify({
  name      : 'myPlugin',
  classname : myClass,
  shorthand : false,
  iterate   : true,
});
```

How it might be used
```js
$('nav ul li').myPlugin({...})
```



### Credit
[monkeymonk](https://gist.github.com/monkeymonk/c08cb040431f89f99928132ca221d647)
[benjasHu](https://gist.github.com/benjasHu/9224d60fe0da10e697a1)

---
_Source: https://npm.io/package/jquery-pluginify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
