namirasoft-core
Advanced tools
Comparing version 1.3.35 to 1.3.36
@@ -8,3 +8,2 @@ import { IStorage } from "./IStorage"; | ||
private getAll; | ||
private setAll; | ||
get(name: string, defaultValue: string): string; | ||
@@ -11,0 +10,0 @@ set(name: string, value: string): void; |
@@ -11,20 +11,11 @@ "use strict"; | ||
getAll() { | ||
var _a; | ||
let ans = {}; | ||
for (let key of Object.keys(this.fixed)) | ||
ans[key] = this.fixed[key]; | ||
let items = document.cookie.split(";"); | ||
for (let i = 0; i < items.length; i++) { | ||
const ops = items[i].split("="); | ||
ans[ops[0]] = ops[1]; | ||
ans[ops[0].trim()] = (_a = ops[1]) === null || _a === void 0 ? void 0 : _a.trim(); | ||
} | ||
return ans; | ||
} | ||
setAll(obj) { | ||
for (let key of Object.keys(this.fixed)) | ||
obj[key] = this.fixed[key]; | ||
let items = []; | ||
for (let key of Object.keys(obj)) | ||
items.push(`${key}=${obj[key]}`); | ||
document.cookie = items.join(";"); | ||
} | ||
get(name, defaultValue) { | ||
@@ -35,10 +26,10 @@ var _a; | ||
set(name, value) { | ||
let all = this.getAll(); | ||
all[name] = value; | ||
this.setAll(all); | ||
let items = []; | ||
for (let key of Object.keys(this.fixed)) | ||
items.push(`${key}=${this.fixed[key]}`); | ||
items.push(`${name}=${value}`); | ||
document.cookie = items.join(";"); | ||
} | ||
del(name) { | ||
let all = this.getAll(); | ||
delete all[name]; | ||
this.setAll(all); | ||
this.set(name, ""); | ||
} | ||
@@ -45,0 +36,0 @@ } |
@@ -11,3 +11,3 @@ { | ||
"private": false, | ||
"version": "1.3.35", | ||
"version": "1.3.36", | ||
"author": "Amir Abolhasani", | ||
@@ -14,0 +14,0 @@ "license": "MIT", |
@@ -14,4 +14,2 @@ import { IStorage } from "./IStorage"; | ||
let ans: { [name: string]: string } = {}; | ||
for (let key of Object.keys(this.fixed)) | ||
ans[key] = this.fixed[key]; | ||
let items = document.cookie.split(";"); | ||
@@ -21,15 +19,6 @@ for (let i = 0; i < items.length; i++) | ||
const ops = items[i].split("="); | ||
ans[ops[0]] = ops[1]; | ||
ans[ops[0].trim()] = ops[1]?.trim(); | ||
} | ||
return ans; | ||
} | ||
private setAll(obj: { [name: string]: string }) | ||
{ | ||
for (let key of Object.keys(this.fixed)) | ||
obj[key] = this.fixed[key]; | ||
let items = []; | ||
for (let key of Object.keys(obj)) | ||
items.push(`${key}=${obj[key]}`); | ||
document.cookie = items.join(";"); | ||
} | ||
override get(name: string, defaultValue: string) | ||
@@ -41,12 +30,12 @@ { | ||
{ | ||
let all = this.getAll(); | ||
all[name] = value; | ||
this.setAll(all); | ||
let items = []; | ||
for (let key of Object.keys(this.fixed)) | ||
items.push(`${key}=${this.fixed[key]}`); | ||
items.push(`${name}=${value}`); | ||
document.cookie = items.join(";"); | ||
} | ||
override del(name: string) | ||
{ | ||
let all = this.getAll(); | ||
delete all[name]; | ||
this.setAll(all); | ||
this.set(name, ""); | ||
} | ||
} |
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
347601
4350