Permalink
Browse files

Fix typo

  • Loading branch information...
thedevsaddam committed Jan 16, 2019
1 parent eea28e9 commit 10121a48bf6476087f4e12888f5c63222657689a
Showing with 7 additions and 7 deletions.
  1. +5 −5 helper.go
  2. +1 −1 jsonq.go
  3. +1 −1 option.go
@@ -106,7 +106,7 @@ type sortMap struct {
data interface{}
key string
desc bool
seperator string
separator string
errs []error
}

@@ -142,11 +142,11 @@ func (s *sortMap) Less(i, j int) (res bool) {

// compare nested values
if strings.Contains(s.key, ".") {
xv, errX := getNestedValue(x, s.key, s.seperator)
xv, errX := getNestedValue(x, s.key, s.separator)
if errX != nil {
s.errs = append(s.errs, errX)
}
yv, errY := getNestedValue(y, s.key, s.seperator)
yv, errY := getNestedValue(y, s.key, s.separator)
if errY != nil {
s.errs = append(s.errs, errY)
}
@@ -190,8 +190,8 @@ func (s *sortMap) compare(x, y interface{}) (res bool) {
}

// getNestedValue fetch nested value from node
func getNestedValue(input interface{}, node, seperator string) (interface{}, error) {
pp := strings.Split(node, seperator)
func getNestedValue(input interface{}, node, separator string) (interface{}, error) {
pp := strings.Split(node, separator)
for _, n := range pp {
if isIndex(n) {
// find slice/array
@@ -425,7 +425,7 @@ func (j *JSONQ) sortBy(property string, asc bool) *JSONQ {
}

sm := &sortMap{}
sm.seperator = j.option.separator
sm.separator = j.option.separator
sm.key = property
if !asc {
sm.desc = true
@@ -22,7 +22,7 @@ func SetDecoder(u Decoder) OptionFunc {
}
}

// SetSeparator set custom seperator for traversing child node, default seperator is DOT (.)
// SetSeparator set custom separator for traversing child node, default separator is DOT (.)
func SetSeparator(s string) OptionFunc {
return func(j *JSONQ) error {
if s == "" {

0 comments on commit 10121a4

Please sign in to comment.