tests.go 362 B

1234567891011121314151617
  1. package objx
  2. // Has gets whether there is something at the specified selector
  3. // or not.
  4. //
  5. // If m is nil, Has will always return false.
  6. func (m Map) Has(selector string) bool {
  7. if m == nil {
  8. return false
  9. }
  10. return !m.Get(selector).IsNil()
  11. }
  12. // IsNil gets whether the data is nil or not.
  13. func (v *Value) IsNil() bool {
  14. return v == nil || v.data == nil
  15. }