https://github.com/shomali11/proper
A string map decorator
https://github.com/shomali11/proper
map parameter parameters properties property string
Last synced: 5 months ago
JSON representation
A string map decorator
- Host: GitHub
- URL: https://github.com/shomali11/proper
- Owner: shomali11
- License: mit
- Created: 2017-06-09T00:52:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-08T03:25:32.000Z (over 6 years ago)
- Last Synced: 2025-04-13T03:49:07.662Z (6 months ago)
- Topics: map, parameter, parameters, properties, property, string
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# proper [](https://travis-ci.com/shomali11/proper) [](https://goreportcard.com/report/github.com/shomali11/proper) [](https://godoc.org/github.com/shomali11/proper) [](https://opensource.org/licenses/MIT)
A `map[string]string` decorator offering a collection of helpful functions to extract the values in different types
## Features
* Retrieve data from a string map, in String, Integer, Float and Boolean types.
* Return a default value in case of missing keys or invalid types# Examples
```go
package mainimport (
"fmt"
"github.com/shomali11/proper"
)func main() {
parameters := make(map[string]string)
parameters["boolean"] = "true"
parameters["float"] = "1.2"
parameters["integer"] = "11"
parameters["string"] = "value"properties := proper.NewProperties(parameters)
fmt.Println(properties.BooleanParam("boolean", false)) // true
fmt.Println(properties.FloatParam("float", 0)) // 1.2
fmt.Println(properties.IntegerParam("integer", 0)) // 11
fmt.Println(properties.StringParam("string", "")) // value
}
```