bmfmt

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2020 License: MIT Imports: 5 Imported by: 0

README

bmfmt Golang [b]eautify [m]ap display [fmt] for Humans

Install

# Stable version
go get -u -v gopkg.in/c0de8/bmfmt.v0

# Latest version
go get -u -v github.com/c0de8/bmfmt

Usage

API Documentation

Examples

package main

import (
	"fmt"
	bmfmt "github.com/c0de8/bmfmt"
)

func main() {
	example()
}

func example() {

	m := map[string][]string{
		"some-key": { "response" },
		"Another-Hash-Key": { "first value", "second value" },
	}

	fmt.Println(m) // fmt the default formatting
	/*
         map[some-key:[response] Another-Hash-Key:[first value second value]]
	*/

	err := bmfmt.Beautify(m) // significant more friendly formatting
	if err != nil {
		fmt.Println("ERROR (bmfmt.Beautify): " + err.Error())
	}
	/*
         [ "some-key"          string(  8) ]: "response"                     string(  8)
         [ "Another-Hash-Key"  string( 16) ]: "first value", "second value"  string( 23)
	*/

}

License

bmfmt is licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Beautify

func Beautify(a interface{}) error

Beautify prints a given map (any key and value type) to a better readable format

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL