0.1.2 • Published 9 years ago

underscore.prefilter v0.1.2

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

underscore.prefilter Build Status

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

var _ = require('underscore');
_.mixin(require('underscore.prefilter'));

Examples

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.

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

10 years ago