The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/app/settings/server/functions/convertValue.ts

17 lines
428 B

import type { ISetting, SettingValue } from '@rocket.chat/core-typings';
export const convertValue = (value: 'true' | 'false' | string, type: ISetting['type']): SettingValue => {
if (value.toLowerCase() === 'true') {
return true;
}
if (value.toLowerCase() === 'false') {
return false;
}
if (type === 'int') {
return parseInt(value);
}
if (type === 'multiSelect') {
return JSON.parse(value);
}
return value;
};