MCPcopy Create free account
hub / github.com/dop251/goja / Equals

Method Equals

value.go:219–236  ·  view source on GitHub ↗
(other Value)

Source from the content-addressed store, hash-verified

217}
218
219func (i valueInt) Equals(other Value) bool {
220 switch o := other.(type) {
221 case valueInt:
222 return i == o
223 case *valueBigInt:
224 return (*big.Int)(o).Cmp(big.NewInt(int64(i))) == 0
225 case valueFloat:
226 return float64(i) == float64(o)
227 case String:
228 return o.ToNumber().Equals(i)
229 case valueBool:
230 return int64(i) == o.ToInteger()
231 case *Object:
232 return i.Equals(o.toPrimitive())
233 }
234
235 return false
236}
237
238func (i valueInt) StrictEquals(other Value) bool {
239 switch o := other.(type) {

Callers

nothing calls this directly

Calls 4

toPrimitiveMethod · 0.80
EqualsMethod · 0.65
ToNumberMethod · 0.65
ToIntegerMethod · 0.65

Tested by

no test coverage detected