vogievetsky commented on a change in pull request #7242: [Console] Add
compaction dialog in druid console which allows users to add/edit data source
compaction configuration
URL: https://github.com/apache/incubator-druid/pull/7242#discussion_r265858120
##########
File path: web-console/src/utils/general.tsx
##########
@@ -137,3 +137,32 @@ export function localStorageGet(key: string): string |
null {
if (typeof localStorage === 'undefined') return null;
return localStorage.getItem(key);
}
+
+// ----------------------------
+
+export function validJson(json: string): boolean {
+ try {
+ JSON.parse(json);
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+// parse JSON to string; if JSON is null, parse empty string ""
+export function parseJSONToString(item: JSON): string {
Review comment:
the JSON to String operation is not usually called 'parse'
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]