@fast-china/utils 1.0.5 → 1.0.6

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.
@@ -30,7 +30,7 @@ var FastUtils = function(exports, vue) {
30
30
  }
31
31
  };
32
32
  const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
33
- const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
33
+ const b64re = /^(?:[A-Z\d+/]{4})*?(?:[A-Z\d+/]{2}(?:==)?|[A-Z\d+/]{3}=?)?$/i;
34
34
  const base64PwdDic = [
35
35
  { index: 977, randomIndex: 188 },
36
36
  { index: 926, randomIndex: 201 },
@@ -255,7 +255,7 @@ var FastUtils = function(exports, vue) {
255
255
  */
256
256
  hexToRgb(str) {
257
257
  let hex = "";
258
- const reg = /^#?[0-9A-Fa-f]{6}$/;
258
+ const reg = /^#?[0-9A-F]{6}$/i;
259
259
  if (!reg.test(str)) throw new FastError("输入错误的hex");
260
260
  str = str.replace("#", "");
261
261
  hex = str.match(/../g);
@@ -283,7 +283,7 @@ var FastUtils = function(exports, vue) {
283
283
  * @returns 返回处理后的颜色值
284
284
  */
285
285
  getDarkColor(color, level) {
286
- const reg = /^#?[0-9A-Fa-f]{6}$/;
286
+ const reg = /^#?[0-9A-F]{6}$/i;
287
287
  if (!reg.test(color)) throw new FastError("输入错误的hex颜色值");
288
288
  const rgb = this.hexToRgb(color);
289
289
  for (let i = 0; i < 3; i++) rgb[i] = Math.round(20.5 * level + rgb[i] * (1 - level));
@@ -296,7 +296,7 @@ var FastUtils = function(exports, vue) {
296
296
  * @returns 返回处理后的颜色值
297
297
  */
298
298
  getLightColor(color, level) {
299
- const reg = /^#?[0-9A-Fa-f]{6}$/;
299
+ const reg = /^#?[0-9A-F]{6}$/i;
300
300
  if (!reg.test(color)) throw new FastError("输入错误的hex颜色值");
301
301
  const rgb = this.hexToRgb(color);
302
302
  for (let i = 0; i < 3; i++) rgb[i] = Math.round(255 * level + rgb[i] * (1 - level));
@@ -6373,7 +6373,7 @@ var FastUtils = function(exports, vue) {
6373
6373
  return n && Object.prototype.hasOwnProperty.call(n, "default") && Object.keys(n).length === 1 ? n["default"] : n;
6374
6374
  }
6375
6375
  function getAugmentedNamespace(n) {
6376
- if (n.__esModule) return n;
6376
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
6377
6377
  var f = n.default;
6378
6378
  if (typeof f == "function") {
6379
6379
  var a = function a2() {
@@ -13881,9 +13881,9 @@ var FastUtils = function(exports, vue) {
13881
13881
  isJson(value) {
13882
13882
  if (!isString(value)) return false;
13883
13883
  value = value.replace(/\s/g, "").replace(/\n|\r/, "");
13884
- if (/^\{(.*?)\}$/.test(value)) return /"(.*?)":(.*?)/g.test(value);
13885
- if (/^\[(.*?)\]$/.test(value)) {
13886
- return value.replace(/^\[/, "").replace(/\]$/, "").replace(/},{/g, "}\n{").split(/\n/).map((s) => {
13884
+ if (/^\{.*?\}$/.test(value)) return /".*?":/.test(value);
13885
+ if (/^\[.*?\]$/.test(value)) {
13886
+ return value.replace(/^\[/, "").replace(/\]$/, "").replace(/\},\{/g, "}\n{").split(/\n/).map((s) => {
13887
13887
  return stringUtil.isJson(s);
13888
13888
  }).reduce((prev, curr) => {
13889
13889
  return !!curr;
@@ -13991,7 +13991,7 @@ var FastUtils = function(exports, vue) {
13991
13991
  cacheKey: "__DEVICE_ID",
13992
13992
  deviceId: ""
13993
13993
  });
13994
- const uuidRegExp = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
13994
+ const uuidRegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
13995
13995
  const makeIdentity = () => {
13996
13996
  if (state.deviceId && uuidRegExp.test(state.deviceId)) {
13997
13997
  Local.set(state.cacheKey, state.deviceId);