Created
October 25, 2011 15:00
-
-
Save clemherreman/1313041 to your computer and use it in GitHub Desktop.
Anonymous functions returning anonymous functions that return what you need.
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
| var qty = parseInt(element.find('.qty').val()) || 0; | |
| var possiblePrices = tierPrices[productId]; | |
| var tierPrice = jQuery.grep(possiblePrices , (function(qty) { | |
| var qty = qty || 1; | |
| return function(possiblePrice) { | |
| return (possiblePrice.qty_min <= qty) | |
| && ((possiblePrice.qty_max > qty) || (possiblePrice.qty_max === 'infinity')); | |
| } | |
| })(qty))[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment