drip-table
Version:
A tiny and powerful enterprise-class solution for building tables.
45 lines (38 loc) • 935 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.encodeJSON = exports.decodeJSON = void 0;
/**
* 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.
*/
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.
*/
exports.encodeJSON = encodeJSON;
var decodeJSON = function decodeJSON(v) {
try {
return JSON.parse(v);
} catch (_unused2) {
return void 0;
}
};
exports.decodeJSON = decodeJSON;