MCPcopy Index your code
hub / github.com/tdewolff/minify / IsLength

Method IsLength

css/css.go:116–128  ·  view source on GitHub ↗

IsLength returns true if the token is a length.

()

Source from the content-addressed store, hash-verified

114
115// IsLength returns true if the token is a length.
116func (t Token) IsLength() bool {
117 if t.TokenType == css.DimensionToken {
118 return true
119 } else if t.TokenType == css.NumberToken && t.Data[0] == '0' {
120 return true
121 } else if t.TokenType == css.FunctionToken {
122 fun := ToHash(t.Data[:len(t.Data)-1])
123 if fun == Calc || fun == Min || fun == Max || fun == Clamp || fun == Attr || fun == Var || fun == Env {
124 return true
125 }
126 }
127 return false
128}
129
130// IsLengthPercentage returns true if the token is a length or percentage token.
131func (t Token) IsLengthPercentage() bool {

Callers 2

IsLengthPercentageMethod · 0.95
minifyPropertyMethod · 0.80

Calls 2

lenFunction · 0.85
ToHashFunction · 0.70

Tested by

no test coverage detected