Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setGist(gist) {
this.setState({ gist });
if (settings.store) storage.set(this.state.gist.name || "gist", gist);
}
setStorageData(data) {
storage.set(name, data);
}
updateGist(value, l1 = false, l2 = false, l3 = false) {
if (!l1) return;
let gist = this.state.gist;
if (l2 && typeof gist[l1] === "undefined") gist[l1] = {};
if (l3 && typeof gist[l1][l2] === "undefined") gist[l1][l2] = {};
if (l3) gist[l1][l2][l3] = value;
else if (l2) gist[l1][l2] = value;
else gist[l1] = value;
this.setState({ gist });
if (settings.store) storage.set(this.state.gist.name || "gist", gist);
}
updateStorageData(value, l1 = false, l2 = false, l3 = false) {
if (!l1) return;
let data = this.state.data;
if (l2 && typeof data[l1] === "undefined") data[l1] = {};
if (l3 && typeof data[l1][l2] === "undefined") data[l1][l2] = {};
if (l3) data[l1][l2][l3] = value;
else if (l2) data[l1][l2] = value;
else data[l1] = value;
this.setState({ data });
storage.set(name, data);
}