Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function saveState(state) {
if (sessionStorageOptOut) return;
try {
const json = stringify(replacerFn(state));
sessionStorage.setItem(STATE_KEY, json);
} catch (e) {
// istanbul ignore next
if (!silent) console.error('redux-util saveState:', e.message);
throw e;
}
}
reply(client, action, error, data) {
const message = stringify({action, data, error: (error && error.stack)});
this.server.emit(client, 'message', message);
}
request(action, data, cb) {
if (!this.connected) {
cb = cb || (() => {});
return cb();
}
if (cb) {
this.once(action, cb);
}
this.client.emit('message', stringify({action: action, data: data}));
}
stringify (obj) {
return stringify(obj)
}
}
export default context => {
return new SafeString('<pre class="debug"><code class="json">' + stringify(context, null, 2) + '</code></pre>');
};
broadcast(action, data) {
ipc.server.broadcast(action, stringify(data));
}
function inspectObject(obj) {
return stringify(obj);
}
async githubSignIn(access_token: string): Promise {
Logger.log(access_token, AuthService.name + ':githubSignIn');
const uriToken = `${this.localUri}/api/auth/github/token`;
try {
const res = await this.httpService
.post(uriToken, { access_token })
.toPromise();
return res.data;
} catch (error) {
const newError = new HttpException(error.response.data, error.response.status);
Logger.error(stringify(newError), undefined, AuthService.name + ':githubSignIn');
throw newError;
}
}
return new Promise((resolve, reject) => {
fs.writeFile(this.dbPath, Flatted.stringify(items), (err, file) => {
if (err) return reject(err)
resolve()
})
})
}
stringify (obj) {
return stringify(obj)
}
}