express-promise
express-promise copied to clipboard
Added posibility to skip toJSON and then filter objects by user own function
When working with Sequelize i created model instance method item.url() and want to use it inside Jade code, also mixed with providing Promise to render method, so i could't use skipTraverse. I had added two optional functions
app.use(require('express-promise')({
disableJSONify: function (object) {
return true; //You can add more logic here if you want to select which page would passed without toJSON call
},
objectFilter: function (object) {
if (object && object.model) //Example for Sequelize, will skip object if it was ORM model
return true;
return false;
}
}));
Also skipTraverse not working for ORM models....