formatifier.go
func ToMorseCode(theString string) (string, error) {
	f := New(theString)

	if f.length < 1 {
		return "", errors.New(lengthError)
	}

	f.makeLower()

	var buffer bytes.Buffer

	for _, i := range f.theString {
		key := string(i)
		if _, ok := morse[key]; ok {
			buffer.WriteString(morse[key])
		} else if key == " " {
			buffer.WriteString(" ")
		}
	}
	return buffer.String(), nil
}
func ToMorseCode(theString string) (string, error) {
	f := New(theString)

	if f.length < 1 {
		return "", errors.New(lengthError)
	}

	f.makeLower()

	var buffer bytes.Buffer

	for _, i := range f.theString {
		key := string(i)
		if _, ok := morse[key]; ok {
			buffer.WriteString(morse[key])
		} else if key == " " {
			buffer.WriteString(" ")
		}
	}
	return buffer.String(), nil
}
func ToMorseCode ( theString string ) ( string , error ) { f := New ( theString ) if f . length < 1 { return " " , errors . New ( lengthError ) } f . makeLower ( ) var buffer bytes . Buffer for _ , i := range f . theString { key := string ( i ) if _ , ok := morse [ key ] ; ok { buffer . WriteString ( morse [ key ] ) } else if key == " " { buffer . WriteString ( " " ) } } return buffer . String ( ) , nil }
// ToMorseCode will format the provided string in Morse Code.
ToMorseCode will format the provided string in Morse Code .