JSONSelect
JSONSelect copied to clipboard
Selected values manipulator in forEach || JSONSelect.map() required.
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.