mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
Add isFunction and isStream helpers
This commit is contained in:
@@ -122,6 +122,26 @@ function isBlob(val) {
|
||||
return toString.call(val) === '[object Blob]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is a Function
|
||||
*
|
||||
* @param {Object} val The value to test
|
||||
* @returns {boolean} True if value is a Function, otherwise false
|
||||
*/
|
||||
function isFunction(val) {
|
||||
return toString.call(val) === '[object Function]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is a Stream
|
||||
*
|
||||
* @param {Object} val The value to test
|
||||
* @returns {boolean} True if value is a Stream, otherwise false
|
||||
*/
|
||||
function isStream(val) {
|
||||
return isObject(val) && isFunction(val.pipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim excess whitespace off the beginning and end of a string
|
||||
*
|
||||
@@ -237,6 +257,8 @@ module.exports = {
|
||||
isDate: isDate,
|
||||
isFile: isFile,
|
||||
isBlob: isBlob,
|
||||
isFunction: isFunction,
|
||||
isStream: isStream,
|
||||
isStandardBrowserEnv: isStandardBrowserEnv,
|
||||
forEach: forEach,
|
||||
merge: merge,
|
||||
|
||||
Reference in New Issue
Block a user