Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stagas/plugs
a generic plugin system
https://github.com/stagas/plugs
Last synced: 14 days ago
JSON representation
a generic plugin system
- Host: GitHub
- URL: https://github.com/stagas/plugs
- Owner: stagas
- Created: 2013-11-19T08:03:25.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-19T08:04:00.000Z (almost 11 years ago)
- Last Synced: 2024-04-08T15:45:29.726Z (7 months ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# plugs
a generic plugin system
## Installation
`npm install plugs`
## Example
```js
var plugs = require('plugs');var obj = plugs({});
obj.use({ foo: 'bar' });
obj.use(function(){
this.baz = 'zoo';
});console.log(obj); // => { foo: 'bar', baz: 'zoo' }
```## Usage
### plugs(object)
Attach `.use()` method to `object`.
### .use(plugin)
Use `plugin`. When a function, it is called with `fn.call(object, object)`.
When an object, its properties are copied over.## License
MIT