From 4660423fcd646f5c81d07cfbb17d6939300017bd Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 28 Feb 2018 16:38:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0object=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bundle.js | 16 ++++++++++++++++ dist/core.js | 16 ++++++++++++++++ dist/fineui.js | 16 ++++++++++++++++ lodash.md | 2 +- src/core/lodash.js | 16 ++++++++++++++++ utils/utils.js | 16 ++++++++++++++++ 6 files changed, 81 insertions(+), 1 deletion(-) diff --git a/dist/bundle.js b/dist/bundle.js index 2ccdf4b3b..2812fa36e 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -17941,6 +17941,21 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) { return baseRandom(lower, upper); } + // Converts lists into objects. Pass either a single array of `[key, value]` + // pairs, or two parallel arrays of the same length -- one of keys, and one of + // the corresponding values. + function object (list, values) { + var result = {}; + for (var i = 0, length = list && list.length; i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; + } + /*------------------------------------------------------------------------*/ /** @@ -18484,6 +18499,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) { lodash.size = size; lodash.some = some; lodash.uniqueId = uniqueId; + lodash.object = object; // Add aliases. lodash.each = forEach; diff --git a/dist/core.js b/dist/core.js index efbd02986..09e23aaf5 100644 --- a/dist/core.js +++ b/dist/core.js @@ -17941,6 +17941,21 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) { return baseRandom(lower, upper); } + // Converts lists into objects. Pass either a single array of `[key, value]` + // pairs, or two parallel arrays of the same length -- one of keys, and one of + // the corresponding values. + function object (list, values) { + var result = {}; + for (var i = 0, length = list && list.length; i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; + } + /*------------------------------------------------------------------------*/ /** @@ -18484,6 +18499,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) { lodash.size = size; lodash.some = some; lodash.uniqueId = uniqueId; + lodash.object = object; // Add aliases. lodash.each = forEach; diff --git a/dist/fineui.js b/dist/fineui.js index 0944c9c3f..83c3d2b1d 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -18142,6 +18142,21 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) { return baseRandom(lower, upper); } + // Converts lists into objects. Pass either a single array of `[key, value]` + // pairs, or two parallel arrays of the same length -- one of keys, and one of + // the corresponding values. + function object (list, values) { + var result = {}; + for (var i = 0, length = list && list.length; i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; + } + /*------------------------------------------------------------------------*/ /** @@ -18685,6 +18700,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) { lodash.size = size; lodash.some = some; lodash.uniqueId = uniqueId; + lodash.object = object; // Add aliases. lodash.each = forEach; diff --git a/lodash.md b/lodash.md index 39afdfc6a..84bbccfff 100644 --- a/lodash.md +++ b/lodash.md @@ -1 +1 @@ -lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random \ No newline at end of file +lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,object \ No newline at end of file diff --git a/src/core/lodash.js b/src/core/lodash.js index 33ba0bcee..435bfb414 100644 --- a/src/core/lodash.js +++ b/src/core/lodash.js @@ -8343,6 +8343,21 @@ return baseRandom(lower, upper); } + // Converts lists into objects. Pass either a single array of `[key, value]` + // pairs, or two parallel arrays of the same length -- one of keys, and one of + // the corresponding values. + function object (list, values) { + var result = {}; + for (var i = 0, length = list && list.length; i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; + } + /*------------------------------------------------------------------------*/ /** @@ -8886,6 +8901,7 @@ lodash.size = size; lodash.some = some; lodash.uniqueId = uniqueId; + lodash.object = object; // Add aliases. lodash.each = forEach; diff --git a/utils/utils.js b/utils/utils.js index 2f623cbf9..633713ac3 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -8343,6 +8343,21 @@ return baseRandom(lower, upper); } + // Converts lists into objects. Pass either a single array of `[key, value]` + // pairs, or two parallel arrays of the same length -- one of keys, and one of + // the corresponding values. + function object (list, values) { + var result = {}; + for (var i = 0, length = list && list.length; i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; + } + /*------------------------------------------------------------------------*/ /** @@ -8886,6 +8901,7 @@ lodash.size = size; lodash.some = some; lodash.uniqueId = uniqueId; + lodash.object = object; // Add aliases. lodash.each = forEach;