1.0.0 • Published 9 years ago

object-lens v1.0.0

Weekly downloads
2
License
-
Repository
github
Last release
9 years ago

object-lens NPM version Downloads Support us Build Status Coveralls Status

Information

Usage

Install

npm install object-lens --save

Example

var filter = require('object-lens');

var schema = {
  name: ['public', 'admin'],
  lastName: ['admin']
};

var data = {
  name: 'Todd',
  lastName: 'Johnson'
};

// Filtering a single piece of data
filter(schema, ['public'], data); // {name: 'Todd'}

// Filtering an array of data
var mapFn = filter.bind(null, schema, ['public']);
var filtered = [data, data].map(mapFn); // [{name: 'Todd'}, {name: 'Todd'}]

LICENSE

(MIT License)

Copyright (c) 2015 Contra contra@maricopa.edu

Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:

The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE ANDNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTIONWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.