Skip to content

Commit

Permalink
Merge pull request basgys#21 from cipriancraciun/patches/fixups
Browse files Browse the repository at this point in the history
Fix issues basgys#17 and basgys#19 (i.e. writing to `stdout` and handling of single digit integers)
  • Loading branch information
basgys authored Oct 31, 2018
2 parents 847318c + d05bb94 commit cbfce0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package xml2json

import (
"bytes"
"fmt"
"io"
"unicode/utf8"
)
Expand Down Expand Up @@ -102,7 +101,6 @@ func (enc *Encoder) format(n *Node, lvl int) error {
if enc.tc == nil {
// do nothing
} else {
fmt.Println(s)
s = enc.tc.Convert(s)
}
enc.write(s)
Expand Down
4 changes: 2 additions & 2 deletions jstype.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ func isFloat(s string) bool {

func isInt(s string) bool {
var output = false
if len(s) > 1 {
if len(s) >= 1 {
_, err := strconv.Atoi(s)
if err == nil { // the string successfully converts to an int
if s[0] == '0' {
if s != "0" && s[0] == '0' {
// if the first rune is '0' and there is more than 1 rune, then the input is most likely a float or intended to be
// a string value -- such as in the case of a guid, or an international phone number
} else {
Expand Down

0 comments on commit cbfce0b

Please sign in to comment.