Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mateusmaso/underscore.prefilter
Underscore helper for pre-filtering methods before calling them
https://github.com/mateusmaso/underscore.prefilter
javascript prefilter underscore
Last synced: 11 days ago
JSON representation
Underscore helper for pre-filtering methods before calling them
- Host: GitHub
- URL: https://github.com/mateusmaso/underscore.prefilter
- Owner: mateusmaso
- License: mit
- Created: 2013-10-05T23:49:10.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-10T06:57:13.000Z (over 9 years ago)
- Last Synced: 2024-10-06T04:22:10.241Z (about 1 month ago)
- Topics: javascript, prefilter, underscore
- Language: JavaScript
- Homepage:
- Size: 184 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
underscore.prefilter [![Build Status](https://travis-ci.org/mateusmaso/underscore.prefilter.svg?branch=master)](https://travis-ci.org/mateusmaso/underscore.prefilter)
====================This library is an extension for Underscore which allows wrapping a conditional method before executing the main one, if true it calls the subsequent method.
## Features
* Prevent functions to be called unintentionally.
## Dependencies
* underscore.js (>= 1.5.0)
## Node
```javascript
var _ = require('underscore');
_.mixin(require('underscore.prefilter'));
```## Examples
```javascript
var bark = function(sentence) {
console.log("woof " + sentence + "!");
};bark = _.prefilter(bark, function(sentence) {
return !_.isNumber(sentence);
});bark("woof"); // woof woof!
bark(123); // undefined
```## License
Copyright (c) 2013-2014 Mateus Maso. Released under an MIT license.