mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-25 12:34:45 -04:00
fix: error in toArrayConfig
If an empty string or undefined is provided the method should not return [], but undefined instead. This way defaults defined in Joi function as expected. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
5db2229771
commit
91d7f1a529
4 changed files with 19 additions and 15 deletions
|
@ -5,9 +5,12 @@
|
|||
*/
|
||||
import { Loglevel } from './loglevel.enum';
|
||||
|
||||
export function toArrayConfig(configValue?: string, separator = ','): string[] {
|
||||
export function toArrayConfig(
|
||||
configValue?: string,
|
||||
separator = ',',
|
||||
): string[] | undefined {
|
||||
if (!configValue) {
|
||||
return [];
|
||||
return undefined;
|
||||
}
|
||||
if (!configValue.includes(separator)) {
|
||||
return [configValue.trim()];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue