isDataView.js 611 B

12345678910111213141516
  1. import tagTester from './_tagTester.js';
  2. import isFunction from './isFunction.js';
  3. import isArrayBuffer from './isArrayBuffer.js';
  4. import { hasDataViewBug } from './_stringTagBug.js';
  5. var isDataView = tagTester('DataView');
  6. // In IE 10 - Edge 13, we need a different heuristic
  7. // to determine whether an object is a `DataView`.
  8. // Also, in cases where the native `DataView` is
  9. // overridden we can't rely on the tag itself.
  10. function alternateIsDataView(obj) {
  11. return obj != null && isFunction(obj.getInt8) && isArrayBuffer(obj.buffer);
  12. }
  13. export default (hasDataViewBug ? alternateIsDataView : isDataView);