diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 09146fc49..c1e9b89d2 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 84fe0e67b..01eb3efe2 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 09146fc49..c1e9b89d2 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 84fe0e67b..01eb3efe2 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 8e7e72ed3..180ca9565 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 af37ac536..cb9b88514 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 6e7119e94..65191028b 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 23bb54ca6..c7a9f4297 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 8a783d812..a306c539c 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 3bd7744c0..58d8c1025 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 000000000..388af5fe6 --- /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