This commit is contained in:
Viet An
2026-05-15 11:18:33 +07:00
parent 869138c003
commit 0ef1d29850
18 changed files with 175 additions and 111 deletions

View File

@@ -4,8 +4,13 @@ export default defineNuxtPlugin(() => {
//==========Find & filter=================
const find = function (arr, obj, attr) {
if (typeof arr === "object" && !Array.isArray(arr)) {
arr = Object.values(arr);
if (!Array.isArray(arr)) {
if (typeof arr === "object") {
arr = Object.values(arr);
} else {
console.error(`arr "${arr}" is not an array`);
return;
}
}
const keys = Object.keys(obj);
let found = arr.find((v) => {