UNPKG

@kangfenmao/keyv-storage

Version:

Simple key-value storage with support for multiple backends

19 lines (18 loc) 377 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isJSON = isJSON; /** * 判断字符串是否是 json 字符串 * @param str 字符串 */ function isJSON(str) { if (typeof str !== 'string') { return false; } try { return typeof JSON.parse(str) === 'object'; } catch (e) { return false; } }