dry-ux 1.39.0 → 1.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Deferred = exports.getUrlParams = exports.insertUrlParams = exports.insertUrlParam = exports.toHashCode = exports.StorageUtils = exports.fnWithAuthCheck = exports.formatDollar = exports.useCountdown = exports.importStyleSheet = exports.importScript = exports.preventDefault = void 0;
|
|
3
|
+
exports.tryParseJson = exports.Deferred = exports.getUrlParams = exports.insertUrlParams = exports.insertUrlParam = exports.toHashCode = exports.StorageUtils = exports.fnWithAuthCheck = exports.formatDollar = exports.useCountdown = exports.importStyleSheet = exports.importScript = exports.preventDefault = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
5
|
/**
|
|
6
6
|
* Returns a function that will call the given handler and prevent the default event behavior.
|
|
@@ -169,3 +169,12 @@ class Deferred {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
exports.Deferred = Deferred;
|
|
172
|
+
const tryParseJson = (json, errorValue = {}) => {
|
|
173
|
+
try {
|
|
174
|
+
return JSON.parse(json);
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
return errorValue;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
exports.tryParseJson = tryParseJson;
|