mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Cleanup _.iteratee doc example. [ci skip]
This commit is contained in:
17
lodash.js
17
lodash.js
@@ -12990,20 +12990,15 @@
|
|||||||
* { 'user': 'fred', 'age': 40 }
|
* { 'user': 'fred', 'age': 40 }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* // wrap to create custom iteratee shorthands
|
* // create custom iteratee shorthands
|
||||||
* _.iteratee = _.wrap(_.iteratee, function(callback, func, thisArg) {
|
* _.iteratee = _.wrap(_.iteratee, function(callback, func) {
|
||||||
* var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
|
* var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);
|
||||||
* if (!match) {
|
* return !p ? callback(func) : function(object) {
|
||||||
* return callback(func, thisArg);
|
* return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]);
|
||||||
* }
|
|
||||||
* return function(object) {
|
|
||||||
* return match[2] == 'gt'
|
|
||||||
* ? object[match[1]] > match[3]
|
|
||||||
* : object[match[1]] < match[3];
|
|
||||||
* };
|
* };
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* _.filter(users, 'age__gt36');
|
* _.filter(users, 'age > 36');
|
||||||
* // => [{ 'user': 'fred', 'age': 40 }]
|
* // => [{ 'user': 'fred', 'age': 40 }]
|
||||||
*/
|
*/
|
||||||
function iteratee(func) {
|
function iteratee(func) {
|
||||||
|
|||||||
Reference in New Issue
Block a user