From 7b56bad08cd7a46ec2ecfccd7f1db80cbfdd2247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libq-=E6=9D=8E=E7=A7=89=E6=9D=83?= Date: Thu, 26 Sep 2024 09:46:15 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-118844=20fix:=20=E6=B7=BB=E5=8A=A0=20=5F?= =?UTF-8?q?.partition=20=E6=BA=90=E7=A0=81=E5=90=A6=E5=88=99=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/1.lodash.js | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/fineui/src/core/1.lodash.js b/packages/fineui/src/core/1.lodash.js index 91035c165..8c1625bb5 100644 --- a/packages/fineui/src/core/1.lodash.js +++ b/packages/fineui/src/core/1.lodash.js @@ -6845,6 +6845,46 @@ } }); + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, the second of which + * contains elements `predicate` returns falsey for. The predicate is + * invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * _.partition(users, function(o) { return o.active; }); + * // => objects for [['fred'], ['barney', 'pebbles']] + * + * // The `_.matches` iteratee shorthand. + * _.partition(users, { 'age': 1, 'active': false }); + * // => objects for [['pebbles'], ['barney', 'fred']] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.partition(users, ['active', false]); + * // => objects for [['barney', 'pebbles'], ['fred']] + * + * // The `_.property` iteratee shorthand. + * _.partition(users, 'active'); + * // => objects for [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + /** * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: @@ -10052,6 +10092,7 @@ lodash.omit = omit; lodash.omitBy = omitBy; lodash.once = once; + lodash.partition = partition; lodash.pick = pick; lodash.pickBy = pickBy; lodash.range = range;