@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.system.js
CHANGED
|
@@ -270,28 +270,30 @@ System.register('Utils', [], (function (exports) {
|
|
|
270
270
|
throw new TypeError("Utils.GMCookie.get 参数cookieName 必须为字符串");
|
|
271
271
|
}
|
|
272
272
|
let cookies = document.cookie.split(";");
|
|
273
|
-
let
|
|
274
|
-
|
|
275
|
-
let
|
|
276
|
-
let
|
|
273
|
+
let findValue = void 0;
|
|
274
|
+
for (const cookieItem of cookies) {
|
|
275
|
+
let item = cookieItem.trim();
|
|
276
|
+
let itemSplit = item.split("=");
|
|
277
|
+
let itemName = itemSplit[0];
|
|
278
|
+
itemSplit.splice(0, 1);
|
|
279
|
+
let itemValue = itemSplit.join("");
|
|
277
280
|
if (itemName === cookieName) {
|
|
278
|
-
|
|
281
|
+
findValue = {
|
|
282
|
+
domain: globalThis.location.hostname,
|
|
283
|
+
expirationDate: null,
|
|
284
|
+
hostOnly: true,
|
|
285
|
+
httpOnly: false,
|
|
286
|
+
name: cookieName,
|
|
287
|
+
path: "/",
|
|
288
|
+
sameSite: "unspecified",
|
|
289
|
+
secure: true,
|
|
290
|
+
session: false,
|
|
291
|
+
value: itemValue,
|
|
292
|
+
};
|
|
293
|
+
break;
|
|
279
294
|
}
|
|
280
|
-
});
|
|
281
|
-
if (findCookie) {
|
|
282
|
-
return {
|
|
283
|
-
domain: globalThis.location.hostname,
|
|
284
|
-
expirationDate: null,
|
|
285
|
-
hostOnly: true,
|
|
286
|
-
httpOnly: false,
|
|
287
|
-
name: cookieName,
|
|
288
|
-
path: "/",
|
|
289
|
-
sameSite: "unspecified",
|
|
290
|
-
secure: true,
|
|
291
|
-
session: false,
|
|
292
|
-
value: findCookie,
|
|
293
|
-
};
|
|
294
295
|
}
|
|
296
|
+
return findValue;
|
|
295
297
|
}
|
|
296
298
|
/**
|
|
297
299
|
* 获取多组Cookie
|
|
@@ -315,9 +317,11 @@ System.register('Utils', [], (function (exports) {
|
|
|
315
317
|
details = utils.assign(details, paramDetails);
|
|
316
318
|
let cookies = document.cookie.split(";");
|
|
317
319
|
cookies.forEach((item) => {
|
|
318
|
-
item = item.
|
|
319
|
-
let
|
|
320
|
-
let
|
|
320
|
+
item = item.trim();
|
|
321
|
+
let itemSplit = item.split("=");
|
|
322
|
+
let itemName = itemSplit[0];
|
|
323
|
+
itemSplit.splice(0, 1);
|
|
324
|
+
let itemValue = itemSplit.join("");
|
|
321
325
|
let nameRegexp = details.name instanceof RegExp
|
|
322
326
|
? details.name
|
|
323
327
|
: new RegExp("^" + details.name, "g");
|
|
@@ -364,9 +368,11 @@ System.register('Utils', [], (function (exports) {
|
|
|
364
368
|
details = utils.assign(details, paramDetails);
|
|
365
369
|
let cookies = document.cookie.split(";");
|
|
366
370
|
cookies.forEach((item) => {
|
|
367
|
-
item = item.
|
|
368
|
-
let
|
|
369
|
-
let
|
|
371
|
+
item = item.trim();
|
|
372
|
+
let itemSplit = item.split("=");
|
|
373
|
+
let itemName = itemSplit[0];
|
|
374
|
+
itemSplit.splice(0, 1);
|
|
375
|
+
let itemValue = itemSplit.join("");
|
|
370
376
|
let nameRegexp = details.name instanceof RegExp
|
|
371
377
|
? details.name
|
|
372
378
|
: new RegExp("^" + details.name, "g");
|