• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Nov-2020-

.travis.ymlH A D15-Nov-2020168 109

LICENSEH A D15-Nov-20201 KiB2217

README.mdH A D15-Nov-20201,003 3828

doc.goH A D15-Nov-202057 31

go.modH A D15-Nov-202037 21

predicates.goH A D15-Nov-2020935 3722

safeExpr.goH A D15-Nov-20202 KiB7452

simplePredicates.goH A D15-Nov-20209.7 KiB360258

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