JsNull.cs 638 B

1234567891011121314151617181920212223242526272829303132333435
  1. using Jint.Runtime;
  2. namespace Jint.Native;
  3. public sealed class JsNull : JsValue, IEquatable<JsNull>
  4. {
  5. internal JsNull() : base(Types.Null)
  6. {
  7. }
  8. public override object ToObject()
  9. {
  10. return null!;
  11. }
  12. public override string ToString()
  13. {
  14. return "null";
  15. }
  16. public override bool IsLooselyEqual(JsValue value)
  17. {
  18. return ReferenceEquals(Null, value) || ReferenceEquals(Undefined, value);
  19. }
  20. public override bool Equals(JsValue? obj)
  21. {
  22. return Equals(obj as JsNull);
  23. }
  24. public bool Equals(JsNull? other)
  25. {
  26. return other is not null;
  27. }
  28. }