Skip to content

Commit

Permalink
0.0.720
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Dec 31, 2023
1 parent fca61ee commit 247a186
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
5 changes: 5 additions & 0 deletions lib/setEnhProp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { setProp } from './setProp.js';
export function setEnhProp(obj, path, val) {
path = path.replace('+', "beEnhanced.by.");
setProp(obj, path, val);
}
5 changes: 5 additions & 0 deletions lib/setEnhProp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {setProp} from './setProp.js';
export function setEnhProp(obj: any, path: string, val: any){
path = path.replace('+', "beEnhanced.by.");
setProp(obj, path, val);
}
26 changes: 11 additions & 15 deletions trHelpers/doUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ export async function doUpdate(transformer, matchingElement, uow) {
const val = await transformer.getDerivedVal(uow, d, matchingElement);
if (s !== undefined) {
const path = s;
if (path[0] === '.') {
const { setProp } = await import('../lib/setProp.js');
setProp(matchingElement, path, val);
}
else {
// if(typeof val === 'object' && !Array.isArray(val)){
// const keys = Object.keys(val);
// if(keys[0] in matchingElement){
// Object.assign(matchingElement, val);
// }else{
// (<any>matchingElement)[s as string] = val;
// }
// }else{
matchingElement[s] = val;
//}
switch (path[0]) {
case '.':
const { setProp } = await import('../lib/setProp.js');
setProp(matchingElement, path, val);
break;
case '+':
const { setEnhProp } = await import('../lib/setEnhProp.js');
setEnhProp(matchingElement, path, val);
break;
default:
matchingElement[s] = val;
}
}
else if (sa !== undefined) {
Expand Down
25 changes: 11 additions & 14 deletions trHelpers/doUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,20 @@ export async function doUpdate<TProps extends {}, TMethods = TProps>(

if(s !== undefined){
const path = s as string;
if(path[0] === '.'){
const {setProp} = await import('../lib/setProp.js');
setProp(matchingElement, path, val);
}else{
// if(typeof val === 'object' && !Array.isArray(val)){
// const keys = Object.keys(val);
// if(keys[0] in matchingElement){
// Object.assign(matchingElement, val);
// }else{
// (<any>matchingElement)[s as string] = val;
// }
// }else{
switch(path[0]){
case '.':
const {setProp} = await import('../lib/setProp.js');
setProp(matchingElement, path, val);
break;
case '+':
const {setEnhProp} = await import('../lib/setEnhProp.js');
setEnhProp(matchingElement, path, val);
break;
default:
(<any>matchingElement)[s as string] = val;
//}

}


}else if(sa !== undefined){
const {A} = await import('../froop/A.js');
A({[sa]: val}, matchingElement);
Expand Down

0 comments on commit 247a186

Please sign in to comment.