Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(helpers): optimize the logic of isAxiosError
1. add the judgment of null
- Loading branch information
1 parent
fe52a61
commit 11c1825
Showing
2 changed files
with
8 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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
'use strict'; | ||
|
||
var utils = require('./../utils'); | ||
|
||
/** | ||
* Determines whether the payload is an error thrown by Axios | ||
* | ||
* @param {*} payload The value to test | ||
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false | ||
*/ | ||
module.exports = function isAxiosError(payload) { | ||
return (typeof payload === 'object') && (payload.isAxiosError === true); | ||
return utils.isObject(payload) && (payload.isAxiosError === true); | ||
}; |
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