-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: inline
is-array-buffer
for webpack compatibility
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*! | ||
* isArrayBuffer v1.0.0 | ||
* https://github.com/fengyuanchen/is-array-buffer | ||
* | ||
* Copyright (c) 2015-2017 Chen Fengyuan | ||
* Released under the MIT license | ||
* | ||
* Date: 2017-07-26T11:00:44.931Z | ||
*/ | ||
|
||
'use strict' | ||
|
||
// temporary workaround for https://github.com/octokit/rest.js/issues/774 | ||
|
||
const hasArrayBuffer = typeof ArrayBuffer === 'function' | ||
const toString = Object.prototype.toString | ||
|
||
/** | ||
* Check if the given value is an ArrayBuffer. | ||
* @param {*} value - The value to check. | ||
* @returns {boolean} Returns `true` if the given is an ArrayBuffer, else `false`. | ||
* @example | ||
* isArrayBuffer(new ArrayBuffer()) | ||
* // => true | ||
* isArrayBuffer(new Array()) | ||
* // => false | ||
*/ | ||
function isArrayBuffer (value) { | ||
return hasArrayBuffer && (value instanceof ArrayBuffer || toString.call(value) === '[object ArrayBuffer]') | ||
} | ||
|
||
module.exports = isArrayBuffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters