<commit_before>package size

import (
	"fmt"

	"github.com/sparkymat/webdsl/types"
)

type Size struct {
	intValue   int64
	floatValue float64
	unit       string
	valueType  types.Type
}

func Px(value int64) Size {
	return Size{intValue: value, unit: "px", valueType: types.Int64}
}

func Percent(value int64) Size {
	return Size{intValue: value, unit: "%", valueType: types.Int64}
}

func Em(value float64) Size {
	return Size{floatValue: value, unit: "em", valueType: types.Float64}
}

func (size Size) String() string {
	switch size.valueType {
	case types.Int8, types.Int16, types.Int32, types.Int64, types.Uint8, types.Uint16, types.Uint32, types.Uint64:
		return fmt.Sprintf("%v%v", size.intValue, size.unit)
	case types.Float32, types.Float64:
		return fmt.Sprintf("%v%v", size.floatValue, size.unit)
	default:
		return fmt.Sprintf("%v%v", size.intValue, size.unit) // FIXME: Better way to handle defaut case?
	}
}<commit_msg>Dropped usage of type package<commit_after>package size

import "fmt"

type unit string

const px unit = "px"
const em unit = "em"
const percent unit = "%"

type Size struct {
	intValue   int64
	floatValue float64
	unit       unit
}

func Px(value int64) Size {
	return Size{intValue: value, unit: px}
}

func Percent(value int64) Size {
	return Size{intValue: value, unit: percent}
}

func Em(value float64) Size {
	return Size{floatValue: value, unit: em}
}

func (size Size) String() string {
	switch size.unit {
	case px, percent:
		return fmt.Sprintf("%v%v", size.intValue, size.unit)
	case em:
		return fmt.Sprintf("%v%v", size.floatValue, size.unit)
	default:
		panic("unsupported unit")
	}
}
{'fraction_non_alphanumeric': 0.12798530312308634, 'fraction_numerical': 0.02694427434170239, 'mean_word_length': 4.357377049180328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3463920', 'n_tokens_mistral': 613, 'n_tokens_neox': 584, 'n_words': 168}