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