From 57ea70af2735db710bd9465ea863c621448420bd Mon Sep 17 00:00:00 2001 From: "lei.wang" Date: Tue, 16 Apr 2019 16:23:05 +0800 Subject: [PATCH] =?UTF-8?q?BI-43211=20feat:createDistinctName=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 2 +- dist/2.0/fineui.js | 2 +- dist/bundle.ie.js | 2 +- dist/bundle.js | 2 +- dist/core.js | 2 +- dist/fineui.ie.js | 2 +- dist/fineui.js | 2 +- dist/fineui_without_jquery_polyfill.js | 2 +- dist/utils.js | 2 +- src/core/func/function.js | 2 +- test/utils/func.test.js | 24 ++++++++++++++++++++++++ 11 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 test/utils/func.test.js diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 09146fc49f..c1e9b89d29 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -18105,7 +18105,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 84fe0e67b3..01eb3efe2f 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -18105,7 +18105,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 09146fc49f..c1e9b89d29 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -18105,7 +18105,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/bundle.js b/dist/bundle.js index 84fe0e67b3..01eb3efe2f 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -18105,7 +18105,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/core.js b/dist/core.js index 8e7e72ed33..180ca9565f 100644 --- a/dist/core.js +++ b/dist/core.js @@ -18105,7 +18105,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index af37ac5361..cb9b885142 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -18350,7 +18350,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/fineui.js b/dist/fineui.js index 6e7119e94c..65191028bb 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -18350,7 +18350,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 23bb54ca6c..c7a9f42972 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -17851,7 +17851,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/dist/utils.js b/dist/utils.js index 8a783d8127..a306c539c8 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -10841,7 +10841,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/src/core/func/function.js b/src/core/func/function.js index 3bd7744c08..58d8c10256 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -15,7 +15,7 @@ _.extend(BI.Func, { name = name || ""; while (true) { if (BI.every(array, function (i, item) { - return item.name !== name; + return BI.isKey(item) ? item !== name : item.name !== name; })) { break; } diff --git a/test/utils/func.test.js b/test/utils/func.test.js new file mode 100644 index 0000000000..388af5fe67 --- /dev/null +++ b/test/utils/func.test.js @@ -0,0 +1,24 @@ +/** + * @Author: lei.wang + * @Maintainers: lei.wang + * @Date: 2019-04-16 + */ +describe("core-function-test", function () { + /** + * test_author_lei.wang + */ + it("createDistinctName-支持字符串数组", function () { + var names = ["name", "name1"]; + expect(BI.Func.createDistinctName(names, "name")).to.equal("name2"); + expect(BI.Func.createDistinctName(names, "name2")).to.equal("name2"); + }); + + /** + * test_author_lei.wang + */ + it("createDistinctName-支持对象数组数组", function () { + var names = [{ name: "name" }, { name: "name1" }]; + expect(BI.Func.createDistinctName(names, "name")).to.equal("name2"); + expect(BI.Func.createDistinctName(names, "name2")).to.equal("name2"); + }); +}); \ No newline at end of file