add functions and variables name

This commit is contained in:
2023-02-25 23:34:15 +00:00
parent 636101f1fa
commit 6ef6e051e6
23 changed files with 414 additions and 97 deletions

30
src/to-argon.go Normal file
View File

@@ -0,0 +1,30 @@
package main
import (
"fmt"
"math"
"strconv"
)
func anyToArgon(x any, quote bool) string {
switch x := x.(type) {
case string:
if !quote {
return x
}
return strconv.Quote(x)
case number:
num, _ := x.Float64()
if math.IsNaN(num) {
return "NaN"
} else if math.IsInf(num, 1) {
return "infinity"
} else if math.IsInf(num, -1) {
return "-infinity"
} else {
return strconv.FormatFloat(num, 'f', -1, 64)
}
default:
return fmt.Sprint(x)
}
}