Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 27-Sep-2021 | - | ||||
.travis.yml | H A D | 27-Sep-2021 | 168 | 10 | 9 | |
LICENSE | H A D | 27-Sep-2021 | 1 KiB | 22 | 17 | |
README.md | H A D | 27-Sep-2021 | 1,003 | 38 | 28 | |
doc.go | H A D | 27-Sep-2021 | 57 | 3 | 1 | |
predicates.go | H A D | 27-Sep-2021 | 935 | 37 | 22 | |
safeExpr.go | H A D | 27-Sep-2021 | 2 KiB | 74 | 52 | |
simplePredicates.go | H A D | 27-Sep-2021 | 9.7 KiB | 360 | 258 |
README.md
1[![Go Report Card](https://goreportcard.com/badge/github.com/go-toolsmith/typep)](https://goreportcard.com/report/github.com/go-toolsmith/typep) 2[![GoDoc](https://godoc.org/github.com/go-toolsmith/typep?status.svg)](https://godoc.org/github.com/go-toolsmith/typep) 3[![Build Status](https://travis-ci.org/go-toolsmith/typep.svg?branch=master)](https://travis-ci.org/go-toolsmith/typep) 4 5# typep 6 7Package typep provides type predicates. 8 9## Installation: 10 11```bash 12go get -v github.com/go-toolsmith/typep 13``` 14 15## Example 16 17```go 18package main 19 20import ( 21 "fmt" 22 23 "github.com/go-toolsmith/typep" 24 "github.com/go-toolsmith/strparse" 25) 26 27func main() { 28 floatTyp := types.Typ[types.Float32] 29 intTyp := types.Typ[types.Int] 30 ptr := types.NewPointer(intTyp) 31 arr := types.NewArray(intTyp, 64) 32 fmt.Println(typep.HasFloatProp(floatTyp)) // => true 33 fmt.Println(typep.HasFloatProp(intTyp)) // => false 34 fmt.Println(typep.IsPointer(ptr)) // => true 35 fmt.Println(typep.IsArray(arr)) // => true 36} 37``` 38