Browse Source

simplify math code

main
familyfriendlymikey 2 years ago
parent
commit
1fd60b48b0
  1. 3
      app/client.imba
  2. 4
      app/components/app-links.imba

3
app/client.imba

@ -231,9 +231,6 @@ tag app
viewing_community_links = no viewing_community_links = no
sort_links! sort_links!
def handle_click_add
handle_add!
def handle_input def handle_input
selection_index = 0 selection_index = 0
sort_links! sort_links!

4
app/components/app-links.imba

@ -22,6 +22,7 @@ tag app-links
try try
let result = Number(eval_math state.query) let result = Number(eval_math state.query)
throw _ if isNaN result throw _ if isNaN result
throw _ if result.toString! is state.query.trim!
result result
catch catch
no no
@ -122,8 +123,7 @@ tag app-links
disabled=state.loading disabled=state.loading
> >
let m = math_result if (let m = math_result) isnt no
if m isnt no and m.toString! isnt state.query.trim!
<.side.right[c:blue3 fs:20px ml:10px w:unset] <.side.right[c:blue3 fs:20px ml:10px w:unset]
@click=handle_click_copy(m) @click=handle_click_copy(m)
> "= {Math.round(m * 100)/100}" > "= {Math.round(m * 100)/100}"

Loading…
Cancel
Save