We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 40cfc66 commit 86c1ff7Copy full SHA for 86c1ff7
src/tree.h
@@ -6,22 +6,16 @@
6
7
/** Get the children of a jsTree (Napi::Object) */
8
inline std::optional<Napi::Array> getChildren(const Napi::Object &&jsTree, const string &&childrenKey) {
9
- Napi::Array childrenArray;
10
-
11
// determine if it has children
12
- auto hasChildren = false;
13
if (jsTree.HasOwnProperty(childrenKey)) {
14
const auto childrenRaw = jsTree.Get(move_const(childrenKey));
15
if (childrenRaw.IsArray()) {
16
- childrenArray = childrenRaw.As<Napi::Array>();
+ const auto childrenArray = childrenRaw.As<Napi::Array>();
17
if (childrenArray.Length() != 0) {
18
- hasChildren = true;
+ return childrenArray;
19
}
20
21
22
- if (hasChildren) {
23
- return childrenArray;
24
- }
25
return {};
26
27
0 commit comments