diff --git a/docs/utils.md b/docs/utils.md index 0baa3879..9e8cb633 100644 --- a/docs/utils.md +++ b/docs/utils.md @@ -48,3 +48,18 @@ Returns: no return, just prints output to STDERR +## has_data +```python +has_data(data) +``` + +Checks if the input contains data. If there are any non-whitespace characters then return True, else return False + +Parameters: + + data: (string) input to check whether it contains data + +Returns: + + Boolean True if input string (data) contains non-whitespace characters, otherwise False + diff --git a/jc/utils.py b/jc/utils.py index 3695a0ee..b5f9a4f0 100644 --- a/jc/utils.py +++ b/jc/utils.py @@ -70,4 +70,15 @@ def compatibility(mod_name, compatible): def has_data(data): + """ + Checks if the input contains data. If there are any non-whitespace characters then return True, else return False + + Parameters: + + data: (string) input to check whether it contains data + + Returns: + + Boolean True if input string (data) contains non-whitespace characters, otherwise False + """ return True if data and not data.isspace() else False