TypeArrayHelper.cs 556 B

123456789101112131415161718192021
  1. using Jint.Runtime;
  2. namespace Jint.Native.TypedArray
  3. {
  4. internal static class TypeArrayHelper
  5. {
  6. internal static TypedArrayInstance ValidateTypedArray(this JsValue o, Realm realm)
  7. {
  8. var typedArrayInstance = o as TypedArrayInstance;
  9. if (typedArrayInstance is null)
  10. {
  11. ExceptionHelper.ThrowTypeError(realm);
  12. }
  13. var buffer = typedArrayInstance._viewedArrayBuffer;
  14. buffer.AssertNotDetached();
  15. return typedArrayInstance;
  16. }
  17. }
  18. }