You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/11/04 14:28:58 UTC
[cordova-common] branch master updated: Use Array.prototype.find in
CordovaError (#97)
This is an automated email from the ASF dual-hosted git repository.
raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-common.git
The following commit(s) were added to refs/heads/master by this push:
new 7c2b8cf Use Array.prototype.find in CordovaError (#97)
7c2b8cf is described below
commit 7c2b8cf7dd7dd813aff905f5d67312c99dfae40d
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Mon Nov 4 15:28:52 2019 +0100
Use Array.prototype.find in CordovaError (#97)
---
src/CordovaError/CordovaError.js | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/CordovaError/CordovaError.js b/src/CordovaError/CordovaError.js
index c7ad82e..05bb7ca 100644
--- a/src/CordovaError/CordovaError.js
+++ b/src/CordovaError/CordovaError.js
@@ -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);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org