Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/safris/object-prototype-filter

Object prototype supplementary filtration functions
https://github.com/safris/object-prototype-filter

Last synced: 1 day ago
JSON representation

Object prototype supplementary filtration functions

Awesome Lists containing this project

README

        

## object-prototype-filter
[![CohesionFirst](https://img.shields.io/badge/CohesionFirst%E2%84%A2--blue.svg)](https://cohesionfirst.com/) [![JavaCommons](https://img.shields.io/badge/angular-js-red.svg)](https://cohesionfirst.com/) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt) [![npm version](https://badge.fury.io/js/object-prototype-filter.svg)](http://badge.fury.io/js/object-prototype-filter)

This is a set of supplementary prototype additions to the Object class that provide filtration functions analogous to that of `Array.prototype.filter()`.

_[Comments and Issues](https://github.com/SevaSafris/object-prototype-filter/issues)_

### Installation

##### NPM
```tcsh
npm install --save object-prototype-filter
```

##### Bower
```tcsh
bower install --save object-prototype-filter
```

##### Manual
```html

```

#### Usage

This supplement adds the following prototype methods to the Object class:

1. **`Object.prototype.filterValues(callback)`** - Creates a new object with all entries that pass the test implemented by the provided function.

**`callback(key, object, thisArg)`** Function is a predicate, to test each element of the array. Return true to keep the element, false otherwise, taking two arguments:
      **`key`** the current key being processed in the object.
      **`object`** the object filter was called upon.
      **`thisArg`** Optional. Value to use as this when executing callback.

**return** A new objet with the elements that pass the test.

### Development

- `npm run build` - Build and minify

### License

This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details