Skip to content

Commit

Permalink
Replaced spaces with tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
CHANTXU64 committed Mar 19, 2023
1 parent 70d457c commit 19fd9bf
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -1408,41 +1408,41 @@ func (f *File) mergeCellsParser(ws *xlsxWorksheet, cell string) (string, error)
}

func CellNameToCoordinatesCacheFunc(capacity int) func(string) (int, int, error) {
cache := make(map[string][2]int, capacity)
cache := make(map[string][2]int, capacity)

return func(cell string) (int, int, error) {
if pos, ok := cache[cell]; ok {
return pos[0], pos[1], nil
}
return func(cell string) (int, int, error) {
if pos, ok := cache[cell]; ok {
return pos[0], pos[1], nil
}

col, row, err := CellNameToCoordinates(cell)
if err != nil {
return 0, 0, err
}
col, row, err := CellNameToCoordinates(cell)
if err != nil {
return 0, 0, err
}

cache[cell] = [2]int{col, row}
return col, row, nil
}
cache[cell] = [2]int{col, row}
return col, row, nil
}
}

var CellNameToCoordinatesCache = CellNameToCoordinatesCacheFunc(1024)

func rangeRefToCoordinatesCacheFunc(capacity int) func(string) ([]int, error) {
cache := make(map[string][]int, capacity)
cache := make(map[string][]int, capacity)

return func(rangeRef string) ([]int, error) {
if coords, ok := cache[rangeRef]; ok {
return coords, nil
}
return func(rangeRef string) ([]int, error) {
if coords, ok := cache[rangeRef]; ok {
return coords, nil
}

coords, err := rangeRefToCoordinates(rangeRef)
if err != nil {
return nil, err
}
coords, err := rangeRefToCoordinates(rangeRef)
if err != nil {
return nil, err
}

cache[rangeRef] = coords
return coords, nil
}
cache[rangeRef] = coords
return coords, nil
}
}

var rangeRefToCoordinatesCache = rangeRefToCoordinatesCacheFunc(1024)
Expand All @@ -1455,9 +1455,9 @@ func (f *File) checkCellInRangeRef(cell, rangeRef string) (bool, error) {
return false, err
}

if strings.Count(rangeRef, ":") != 1 {
return false, err
}
if strings.Count(rangeRef, ":") != 1 {
return false, err
}
coordinates, err := rangeRefToCoordinatesCache(rangeRef)
if err != nil {
return false, err
Expand Down

0 comments on commit 19fd9bf

Please sign in to comment.