Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
harshdoesdev committed Sep 12, 2023
1 parent f8f4d96 commit 7109212
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 28 deletions.
22 changes: 14 additions & 8 deletions fastn-js/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ let fastn_utils = {
return this.getStaticValue(obj.get());
} else if (obj instanceof fastn.mutableListClass) {
return obj.getList();
} else if (obj instanceof fastn.recordInstanceClass) {
return obj.toObject();
} else {
} /*else if (obj instanceof fastn.recordInstanceClass) {
return obj.getAllFields();
}*/ else {
return obj;
}
},
Expand Down Expand Up @@ -107,15 +107,13 @@ let fastn_utils = {
if (Array.isArray(staticValue)) {
return staticValue.map(func =>
fastn_utils.getFlattenStaticValue(func.item));
} /*
Todo: Make this work
else if (typeof staticValue === 'object' && fastn_utils.isNull(staticValue)) {
} else if (typeof staticValue === 'object' && fastn_utils.isNull(staticValue)) {
return Object.fromEntries(
Object.entries(staticValue).map(([k,v]) =>
[k, fastn_utils.getFlattenStaticValue(v)]
)
);
}*/
}
return staticValue;
},
getter(value) {
Expand All @@ -140,7 +138,15 @@ let fastn_utils = {
const parts = notation.split('.');

return parts
.reduce((obj, key) => fastn_utils.getFlattenStaticValue(obj[key]), fastn_utils.getFlattenStaticValue(value));
.reduce((obj, key) => {
const value = fastn_utils.getFlattenStaticValue(obj[key]);

if(value instanceof fastn.recordInstanceClass) {
return value.getAllFields();
}

return value;
}, fastn_utils.getFlattenStaticValue(value));
},
setter(variable, value) {
if (!fastn_utils.isNull(variable) && variable.set) {
Expand Down
2 changes: 1 addition & 1 deletion ftd/t/js/04-variable.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/05-dynamic-dom-list.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ftd/t/js/06-dynamic-dom-list-2.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/07-dynamic-dom-record-list.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ftd/t/js/23-record-list.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions ftd/t/js/29-dom-list.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ftd/t/js/31-advance-list.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/31-ftd-len.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/32-ftd-len.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/33-list-indexing.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/52-events.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
148 changes: 148 additions & 0 deletions ftd/t/js/58-dot-notation-referencing.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7109212

Please sign in to comment.