namirasoft-core
Advanced tools
Comparing version 1.3.40 to 1.3.41
import { IStorage } from "./IStorage"; | ||
export declare class IStorageCookie extends IStorage { | ||
private fixed; | ||
private cookies?; | ||
constructor(fixed: { | ||
[name: string]: string; | ||
}); | ||
}, cookies?: string); | ||
private getAll; | ||
@@ -8,0 +9,0 @@ get(name: string, defaultValue: string): string; |
@@ -7,13 +7,14 @@ "use strict"; | ||
class IStorageCookie extends IStorage_1.IStorage { | ||
constructor(fixed) { | ||
constructor(fixed, cookies) { | ||
super(); | ||
this.fixed = fixed; | ||
this.cookies = cookies; | ||
} | ||
getAll() { | ||
var _a; | ||
var _a, _b; | ||
let ans = {}; | ||
let items = document.cookie.split(";"); | ||
let items = ((_a = this.cookies) !== null && _a !== void 0 ? _a : document.cookie).split(";"); | ||
for (let i = 0; i < items.length; i++) { | ||
const ops = items[i].split("="); | ||
ans[ops[0].trim()] = (_a = ops[1]) === null || _a === void 0 ? void 0 : _a.trim(); | ||
ans[ops[0].trim()] = (_b = ops[1]) === null || _b === void 0 ? void 0 : _b.trim(); | ||
} | ||
@@ -20,0 +21,0 @@ return ans; |
@@ -11,3 +11,3 @@ { | ||
"private": false, | ||
"version": "1.3.40", | ||
"version": "1.3.41", | ||
"author": "Amir Abolhasani", | ||
@@ -14,0 +14,0 @@ "license": "MIT", |
@@ -7,6 +7,8 @@ import { EncodingOperation } from "./EncodingOperation"; | ||
private fixed: { [name: string]: string }; | ||
constructor(fixed: { [name: string]: string }) | ||
private cookies?: string; | ||
constructor(fixed: { [name: string]: string }, cookies?: string) | ||
{ | ||
super(); | ||
this.fixed = fixed; | ||
this.cookies = cookies; | ||
} | ||
@@ -16,3 +18,3 @@ private getAll(): { [name: string]: string } | ||
let ans: { [name: string]: string } = {}; | ||
let items = document.cookie.split(";"); | ||
let items = (this.cookies ?? document.cookie).split(";"); | ||
for (let i = 0; i < items.length; i++) | ||
@@ -19,0 +21,0 @@ { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
349812
4396