Skip to content
Permalink
Browse files
Use Array.prototype.find in CordovaError (#97)
  • Loading branch information
raphinesse committed Nov 4, 2019
1 parent 8bd95b4 commit 7c2b8cf7dd7dd813aff905f5d67312c99dfae40d
Showing 1 changed file with 2 additions and 5 deletions.
@@ -42,11 +42,8 @@ class CordovaError extends Error {
* @returns {string} Error code string name
*/
getErrorCodeName () {
for (const key of Object.keys(CordovaError)) {
if (CordovaError[key] === this.code) {
return key;
}
}
return Object.keys(CordovaError)
.find(key => CordovaError[key] === this.code);
}

/**

0 comments on commit 7c2b8cf

Please sign in to comment.