From 5f1f018a30f3b98e75af77a57fba399eee78fa0b Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 10 May 2024 16:52:19 +0100 Subject: [PATCH] Fundamental behaviour, not return type --- code_style.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code_style.md b/code_style.md index cab6d36d08..e6ad053111 100644 --- a/code_style.md +++ b/code_style.md @@ -225,11 +225,11 @@ Unless otherwise specified, the following applies to all code: } ``` -37. Avoid functions whose behaviour / return type varies with different parameter types. - Multiple return types are fine, but the function's fundamental behaviour should not - change according its arguments: have two separate functions. For example, `SDKConfig.get()` - with a string param which returns the type according to the param given is ok, but `SDKConfig.get()` - with no args returning the whole config object would not be: this should just be a separate function. +37. Avoid functions whose fundamental behaviour varies with different parameter types. + Multiple return types are fine, but if the function's behaviour is going to change significantly, + have two separate functions. For example, `SDKConfig.get()` with a string param which returns the + type according to the param given is ok, but `SDKConfig.get()` with no args returning the whole + config object would not be: this should just be a separate function. ## React