re-add static Cookie.fromObject() function

This commit is contained in:
jkhsjdhjs 2019-08-17 05:42:18 +02:00
parent ff7aaf3706
commit 3f66e804e5
Signed by: jkhsjdhjs
GPG Key ID: BAC6ADBAB7D576CC

View File

@ -108,6 +108,12 @@ export default class Cookie {
if(!this.expiry) if(!this.expiry)
this.expiry = null; this.expiry = null;
} }
static fromObject(obj) {
let c = Object.assign(Object.create(this.prototype), obj);
if(typeof c.expiry === "string")
c.expiry = new Date(c.expiry);
return c;
}
serialize() { serialize() {
return this.name + "=" + this.value; return this.name + "=" + this.value;
} }