Skip to content

Added posibility to skip toJSON and then filter objects by user own function #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

semoro
Copy link

@semoro semoro commented Oct 5, 2015

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;
    }
}));

@semoro
Copy link
Author

semoro commented Oct 5, 2015

Also skipTraverse not working for ORM models....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant