hooks-js icon indicating copy to clipboard operation
hooks-js copied to clipboard

Augment your methods with pre and post hooks

Results 10 hooks-js issues
Sort by recently updated
recently updated
newest added

Using callbacks: ```js toySchema.pre('save', function (next) { if (!this.created) this.created = new Date next() }) ``` Using promises: ```js toySchema.pre('save', async function () { if (!this.created) this.created = new Date...

What about using hooks in base and sub classes ? Look at this use case ``` js var hooks = require("hooks") var _ = require('underscore') // Document definition var Document...

With 0.3.2 and 0.2.1 ``` js var hooks = require('hooks'); function Doc(data) { this.name = data.name; } // Add hooks' methods: `hook`, `pre`, and `post` for (var k in hooks)...

Let's say I have a JavaScript constructor as follows: ``` js function MyModel() { } MyModel.create = function(...); ``` How can I set up pre/post hooks for MyModel.create? The code...

This fix is definitely needed to make mongoosejs work with 0.3.0 and asyncronous post middlewares. It fixes callbacks (adds proper arguments). Thank you

Would it be possible to include a LICENSE file with the text of the license agreement? Our lawyers are saying that just having "License: MIT" is not sufficient.