drip-table
Version:
A tiny and powerful enterprise-class solution for building tables.
33 lines (31 loc) • 749 B
JavaScript
/**
* This file is part of the drip-table project.
* @link : https://drip-table.jd.com/
* @author : Emil Zhai (root@derzh.com)
* @modifier : Emil Zhai (root@derzh.com)
* @copyright: Copyright (c) 2021 JD Network Technology Co., Ltd.
*/
/**
* Stringify JSON
* @param v Data to be stringify
* @returns Stringified JSON, or empty string while encode failed.
*/
export var encodeJSON = function encodeJSON(v) {
try {
return JSON.stringify(v);
} catch (_unused) {
return '';
}
};
/**
* Decode JSON.
* @param v Stringified JSON.
* @returns JSON data, or undefined while decode failed.
*/
export var decodeJSON = function decodeJSON(v) {
try {
return JSON.parse(v);
} catch (_unused2) {
return void 0;
}
};