1.
This commit is contained in:
22
unpackage/dist/dev/mp-weixin/utils/util.js
vendored
22
unpackage/dist/dev/mp-weixin/utils/util.js
vendored
@@ -1,6 +1,25 @@
|
||||
"use strict";
|
||||
require("../common/vendor.js");
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
require("../request/http.js");
|
||||
function isValidJSON(jsonString) {
|
||||
if (typeof jsonString !== "string") {
|
||||
common_vendor.index.__f__("warn", "at utils/util.js:49", "输入必须是字符串类型");
|
||||
return false;
|
||||
}
|
||||
jsonString = jsonString.trim();
|
||||
if (jsonString === "") {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(jsonString);
|
||||
if (typeof parsed !== "object" || parsed === null)
|
||||
return false;
|
||||
return true;
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("log", "at utils/util.js:70", "JSON 格式错误:", error.message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function accDiv(arg1, arg2) {
|
||||
var t1 = 0, t2 = 0, r1, r2;
|
||||
try {
|
||||
@@ -131,5 +150,6 @@ exports.getLocaleMonthDayHourMinte = getLocaleMonthDayHourMinte;
|
||||
exports.getLocaleTime = getLocaleTime;
|
||||
exports.getRateStr = getRateStr;
|
||||
exports.getRateUpOrDown = getRateUpOrDown;
|
||||
exports.isValidJSON = isValidJSON;
|
||||
exports.replaceAnswerLabel = replaceAnswerLabel;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/util.js.map
|
||||
|
||||
Reference in New Issue
Block a user