Stop being the product.
Become the owner.
or
sign uplog in

How much do you hate this pattern? My goal is to make the…

How much do you hate this pattern?

My goal is to make the DTOs super cheap, and while not pure data objects, never able to hit a branch from internal logic. This my crude approximation of how rust does things.

export class Selection {
type = "Selection";
constructor(start, end){
this.start = start;
this.end = end;
}


get start() {this.start};
get end() {this.end};
}


export function SelectionFunctions(selection) {
return {
"normalized": () => { // returns selection aranged small to big, effectivly ignoring direction
if(selection.start < selection.end) {
return [selection.start, selection.end]
}
return [selection.end, selection.start];
},
"isRange": () => {
return selection.start !== selection.end;
}
};
}
#programming #dev #technology #js
source
earnings
1,000 mlx total
$0  total
engagement
3 views
0 reactions

0 comments