array-permit
v0.0.3
Published
Library for filter object keys in RoR style
Downloads
3
Readme
Library for filter object keys in RoR style
var some_object = {field1: 123, field2: 234, field3: 456, field4: {f1: "a", f2:"b"}};
var filtered_object = some_object.permit("field1", "field2", {name: "field4", fields: ["f1"]}) // {field1: 123, field2: 234, field4: {f1: "a"}};
filtered_object = some_object.permit("field1", {name:"field2", type: String}, {name: "field4", type:Object, fields: ["f1"]}) // {field1: 123, field2: 234, field4: {f1: "a"}};