mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(util) findObjByNameInArr: find array in array first
This commit is contained in:
parent
1528ee5a10
commit
b6f5b45279
2 changed files with 13 additions and 7 deletions
|
|
@ -8,7 +8,7 @@
|
|||
"contact",
|
||||
"socket",
|
||||
"terminal",
|
||||
"console", {
|
||||
"console", [{
|
||||
"name": "storage",
|
||||
"data": [{
|
||||
"name": "DropBox",
|
||||
|
|
@ -48,5 +48,5 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}]
|
||||
]
|
||||
|
|
|
|||
14
lib/util.js
14
lib/util.js
|
|
@ -886,12 +886,18 @@
|
|||
|
||||
if (isArray) {
|
||||
array.some(function(item) {
|
||||
var is = item.name === name;
|
||||
var is,
|
||||
isArray = Util.isArray(item);
|
||||
|
||||
if (is)
|
||||
ret = item.data;
|
||||
if (isArray)
|
||||
item.some(function(item) {
|
||||
is = item.name === name;
|
||||
|
||||
if (is)
|
||||
ret = item.data;
|
||||
});
|
||||
|
||||
return is;
|
||||
return is;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue