filter-properties

1.0.0 • Public • Published

filter-properties

Filter object properties using a whitelist

Installation

npm install filter-properties --save

API

filter(Array whitelist, Object object) -> Object

The whitelist is an Array of strings.

var whitelist = [ "username" ]

The object is the input data.

var object = { username: "acro", gender: "male" }

Applying the filter function onto these two inputs will return a filtered object.

var filter = require("filter-properties")

var filtered = filter(whitelist, object)
// { username: "acro" }

Dependencies

This library has no dependencies.

License

MIT

/filter-properties/

    Package Sidebar

    Install

    npm i filter-properties

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • acro