npminstallfilter-properties--saveThe whitelist is an Array of strings.
varwhitelist=["username"]The object is the input data.
varobject={username: "acro",gender: "male"}Applying the filter function onto these two inputs will return a filtered object.
varfilter=require("filter-properties")varfiltered=filter(whitelist,object)// { username: "acro" }This library has no dependencies.
MIT