@whitesev/utils 1.1.4 → 1.1.5
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.
- package/dist/index.amd.js +31 -25
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +31 -25
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +31 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +31 -25
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +31 -25
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +31 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/src/UtilsGMCookie.d.ts +4 -15
- package/package.json +1 -1
- package/src/UtilsGMCookie.ts +36 -30
package/dist/index.iife.js
CHANGED
|
@@ -268,28 +268,30 @@ var Utils = (function () {
|
|
|
268
268
|
throw new TypeError("Utils.GMCookie.get 参数cookieName 必须为字符串");
|
|
269
269
|
}
|
|
270
270
|
let cookies = document.cookie.split(";");
|
|
271
|
-
let
|
|
272
|
-
|
|
273
|
-
let
|
|
274
|
-
let
|
|
271
|
+
let findValue = void 0;
|
|
272
|
+
for (const cookieItem of cookies) {
|
|
273
|
+
let item = cookieItem.trim();
|
|
274
|
+
let itemSplit = item.split("=");
|
|
275
|
+
let itemName = itemSplit[0];
|
|
276
|
+
itemSplit.splice(0, 1);
|
|
277
|
+
let itemValue = itemSplit.join("");
|
|
275
278
|
if (itemName === cookieName) {
|
|
276
|
-
|
|
279
|
+
findValue = {
|
|
280
|
+
domain: globalThis.location.hostname,
|
|
281
|
+
expirationDate: null,
|
|
282
|
+
hostOnly: true,
|
|
283
|
+
httpOnly: false,
|
|
284
|
+
name: cookieName,
|
|
285
|
+
path: "/",
|
|
286
|
+
sameSite: "unspecified",
|
|
287
|
+
secure: true,
|
|
288
|
+
session: false,
|
|
289
|
+
value: itemValue,
|
|
290
|
+
};
|
|
291
|
+
break;
|
|
277
292
|
}
|
|
278
|
-
});
|
|
279
|
-
if (findCookie) {
|
|
280
|
-
return {
|
|
281
|
-
domain: globalThis.location.hostname,
|
|
282
|
-
expirationDate: null,
|
|
283
|
-
hostOnly: true,
|
|
284
|
-
httpOnly: false,
|
|
285
|
-
name: cookieName,
|
|
286
|
-
path: "/",
|
|
287
|
-
sameSite: "unspecified",
|
|
288
|
-
secure: true,
|
|
289
|
-
session: false,
|
|
290
|
-
value: findCookie,
|
|
291
|
-
};
|
|
292
293
|
}
|
|
294
|
+
return findValue;
|
|
293
295
|
}
|
|
294
296
|
/**
|
|
295
297
|
* 获取多组Cookie
|
|
@@ -313,9 +315,11 @@ var Utils = (function () {
|
|
|
313
315
|
details = utils.assign(details, paramDetails);
|
|
314
316
|
let cookies = document.cookie.split(";");
|
|
315
317
|
cookies.forEach((item) => {
|
|
316
|
-
item = item.
|
|
317
|
-
let
|
|
318
|
-
let
|
|
318
|
+
item = item.trim();
|
|
319
|
+
let itemSplit = item.split("=");
|
|
320
|
+
let itemName = itemSplit[0];
|
|
321
|
+
itemSplit.splice(0, 1);
|
|
322
|
+
let itemValue = itemSplit.join("");
|
|
319
323
|
let nameRegexp = details.name instanceof RegExp
|
|
320
324
|
? details.name
|
|
321
325
|
: new RegExp("^" + details.name, "g");
|
|
@@ -362,9 +366,11 @@ var Utils = (function () {
|
|
|
362
366
|
details = utils.assign(details, paramDetails);
|
|
363
367
|
let cookies = document.cookie.split(";");
|
|
364
368
|
cookies.forEach((item) => {
|
|
365
|
-
item = item.
|
|
366
|
-
let
|
|
367
|
-
let
|
|
369
|
+
item = item.trim();
|
|
370
|
+
let itemSplit = item.split("=");
|
|
371
|
+
let itemName = itemSplit[0];
|
|
372
|
+
itemSplit.splice(0, 1);
|
|
373
|
+
let itemValue = itemSplit.join("");
|
|
368
374
|
let nameRegexp = details.name instanceof RegExp
|
|
369
375
|
? details.name
|
|
370
376
|
: new RegExp("^" + details.name, "g");
|