Closed caseyWebb closed 7 years ago
Changes made in postValidate and preSave hooks were not being persisted; now they are :tada:
Also FWIW, besides semantics, there seems to me to be no noticeable between the two hooks.
This...
// ... return Promise.all(that._getHookPromises('postValidate')); }).then(function() { return Promise.all(that._getHookPromises('preSave')); }).then(function() { // ...
could be changed to something like...
return Promise.all(_.compose(_.flatten, _.map)(['postValidate', 'preSave'], function(hookName) { return that._getHookPromises(hookName); }))
...which isn't all that great, but can turn into this...
return Promise.all(_.flatMap(['postValidate', 'preSave'], (h) => this._getHookPromises(h)))
arrow funcs <3 fp & promises, their lack of lexical binding prevents the need for var that = this in nearly every case
var that = this
[x-ref #43]
Looks good from what I can tell. Should have time to get to this tonight or tomorrow morning. Thanks for the PR!
🍻
Changes made in postValidate and preSave hooks were not being persisted; now they are :tada:
Also FWIW, besides semantics, there seems to me to be no noticeable between the two hooks.
This...
could be changed to something like...
...which isn't all that great, but can turn into this...
arrow funcs <3 fp & promises, their lack of lexical binding prevents the need for
var that = this
in nearly every case[x-ref #43]