Sitelet https://github.com/lloyd/JSONSelect/issues/54
Skip to content

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

Description

@dead1

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions