From b1307077482b1d436dcd8842220cb50889822d42 Mon Sep 17 00:00:00 2001 From: Janzen Houchen-Wilder Date: Mon, 5 Jun 2023 18:16:26 -0700 Subject: [PATCH 1/3] Fixed typo in single responsiblity principle. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 81a1a20..047f984 100644 --- a/README.md +++ b/README.md @@ -1857,7 +1857,7 @@ class UserSettings public void ChangeSettings(Settings settings) { - if (verifyCredentials()) + if (VerifyCredentials()) { // ... } From 0257caa711d4816ec424ed87a6389f1ec0094135 Mon Sep 17 00:00:00 2001 From: Janzen Houchen-Wilder Date: Mon, 5 Jun 2023 18:26:07 -0700 Subject: [PATCH 2/3] Renamed a variable as const char = data.charCodeAt(i); will not work since 'char' is a type. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 047f984..feda6d7 100644 --- a/README.md +++ b/README.md @@ -2633,7 +2633,7 @@ Thrown errors are a good thing! They mean the runtime has successfully identifie If you need to re-throw an exception after catching it, use just 'throw' By using this, you will save the stack trace. But in the bad option below, -you will lost the stack trace. +you will lose the stack trace. **Bad:** @@ -3121,9 +3121,9 @@ public int HashIt(string data) for (var i = 0; i < length; i++) { // Get character code. - const char = data.charCodeAt(i); + const charCode = data.charCodeAt(i); // Make the hash - hash = ((hash << 5) - hash) + char; + hash = ((hash << 5) - hash) + charCode; // Convert to 32-bit integer hash &= hash; } @@ -3139,8 +3139,8 @@ public int HashIt(string data) var length = data.length; for (var i = 0; i < length; i++) { - const char = data.charCodeAt(i); - hash = ((hash << 5) - hash) + char; + const charCode = data.charCodeAt(i); + hash = ((hash << 5) - hash) + charCode; // Convert to 32-bit integer hash &= hash; From 0c99721fcc657dd2e98fced11ee3c370292e4132 Mon Sep 17 00:00:00 2001 From: Janzen Houchen-Wilder Date: Mon, 5 Jun 2023 18:32:02 -0700 Subject: [PATCH 3/3] Fixed previous commit with actual code that will compile. My previous commit will be overridden by this which will work. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index feda6d7..070104f 100644 --- a/README.md +++ b/README.md @@ -3121,9 +3121,9 @@ public int HashIt(string data) for (var i = 0; i < length; i++) { // Get character code. - const charCode = data.charCodeAt(i); + const char character = data.charCodeAt(i); // Make the hash - hash = ((hash << 5) - hash) + charCode; + hash = ((hash << 5) - hash) + character; // Convert to 32-bit integer hash &= hash; } @@ -3139,8 +3139,8 @@ public int HashIt(string data) var length = data.length; for (var i = 0; i < length; i++) { - const charCode = data.charCodeAt(i); - hash = ((hash << 5) - hash) + charCode; + const char character = data.charCodeAt(i); + hash = ((hash << 5) - hash) + character; // Convert to 32-bit integer hash &= hash;