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.
@@ -53,3 +53,4 @@ export declare class Deferred<T> {
53
53
  get resolve(): (result: T) => void;
54
54
  get reject(): (error: any) => void;
55
55
  }
56
+ export declare const tryParseJson: <T = any>(json: string, errorValue?: {}) => {};
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dry-ux",
3
- "version": "1.39.0",
3
+ "version": "1.40.0",
4
4
  "description": "",
5
5
  "main": "dist/index",
6
6
  "scripts": {