Skip to content

Commit

Permalink
Merge pull request #10 from kentlouisetonino/feat/cleanup-files
Browse files Browse the repository at this point in the history
feat: Clean Up
  • Loading branch information
kentlouisetonino committed May 8, 2024
2 parents e879f07 + f8fc812 commit 7c6845b
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/services/binary/get_binary_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/kentlouisetonino/baseshift/src/helpers"
)

// This handles the binary input value and its validation.
func getBinaryInput() int64 {
var option int64
var optionChecker string
Expand Down
1 change: 0 additions & 1 deletion src/services/binary/get_binary_to_decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package binary

import "math"

// Converts binary number to decimal.
func getBinaryToDecimal(binary int64) int64 {
binaryToArray := getReversedBinaryArray(binary)
decimal := int64(0)
Expand Down
1 change: 0 additions & 1 deletion src/services/binary/get_reverse_int_array.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package binary

// Reversed the array of int64.
func getReverseIntArray(array []int64) []int64 {
lastIndex := len(array) - 1
reversedArray := []int64{}
Expand Down
1 change: 0 additions & 1 deletion src/services/binary/get_reversed_binary_array.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package binary

// Reversed the binary and return an array of binary.
func getReversedBinaryArray(binary int64) []int64 {
var arrayOfBinary []int64

Expand Down
1 change: 0 additions & 1 deletion src/services/decimal/get_decimal_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/kentlouisetonino/baseshift/src/helpers"
)

// This handles the decimal input value and its validation.
func getDecimalInput() int64 {

// Declare the variables.
Expand Down
1 change: 0 additions & 1 deletion src/services/decimal/get_decimal_to_binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"strings"
)

// Converts binary number to decimal.
func getDecimalToBinary(decimal int64) int64 {
binaryStringArray := []string{}

Expand Down
3 changes: 1 addition & 2 deletions src/services/hexadecimal/get_hexadecimal_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

func getHexadecimalInput() string {
var optionChecker string
validOptions := []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}

// Ask the octal input from the end user.
fmt.Print(helpers.ThreeSpace, "Hexadecimal", helpers.ThreeSpace, ": ")
Expand All @@ -21,7 +20,7 @@ func getHexadecimalInput() string {
// Check if hexadecimal input is valid.
hexadecimalArray := strings.SplitAfter(optionChecker, "")
for i := 0; i < len(hexadecimalArray); i++ {
if slices.Contains(validOptions, hexadecimalArray[i]) == false {
if slices.Contains(hexValidOptions, hexadecimalArray[i]) == false {
return "-1"
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/services/hexadecimal/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ var hexToBinaryArrayMap = map[string][]int{
"E": {1, 1, 1, 0},
"F": {1, 1, 1, 1},
}

var hexValidOptions = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}

0 comments on commit 7c6845b

Please sign in to comment.