Skip to content
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

Selected values manipulator in forEach || JSONSelect.map() required. #54

Open
dead1 opened this issue Feb 26, 2014 · 0 comments
Open

Selected values manipulator in forEach || JSONSelect.map() required. #54

dead1 opened this issue Feb 26, 2014 · 0 comments

Comments

@dead1
Copy link

dead1 commented Feb 26, 2014

I'm trying to validate nodejs app POST input with JSONSelect. It would be nice if I could also manipulate the selected data. Like in the following code:

JSONSelect.forEach(
    ".points_to_delete .id," +
    ".points_to_update .status," +
    ".points_to_update .task_id," +
    ".points_to_update .warning",
    args,
function(item,itemManipulator)
{
    if(require('validator').isNumeric(item))
    {
        itemManipulator.setItemValue(parseInt(item))
    }
    else
    {
        throw Error("Item is not numeric!")
    }
})

Probably, it would be better to create JSONSelect.map() for this purposes. Thank you.

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

No branches or pull requests

1 participant