-
-
Save josephdburdick/d6e1806540b629c72d71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // non-modular | |
| jQuery.fn.limit = function(count){ | |
| return $(this).filter(function(index){ return index < count; }); | |
| }; | |
| // non-modular usage | |
| $('sel').limit(3); | |
| // modular | |
| var $ = require('jquery'); | |
| var limit = function(count){ | |
| return $(this).filter(function(index){ return index < count; }); | |
| }; | |
| module.exports = Function.call.bind(limit); | |
| // modular usage | |
| var limit = require('./plugins/limit'); | |
| limit($('sel'), 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment