Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';
import { Effect } from '@ngrx/effects';
import { ActionReducer } from '@ngrx/store';
import { defer, from, Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
const STORAGE_KEY = 'NSIS_APP_STATE';
const storage = new Storage({});
// get/setNested inspired by
// https://github.com/mickhansen/dottie.js
function getNested(obj: any, path: string): any {
if (obj !== null && path) {
// Recurse into the object.
const parts = path.split('.').reverse();
while (obj != null && parts.length) {
obj = obj[parts.pop()];
}
}
return obj;
}
function setNested(obj: any, path: string, value: any): any {
if (obj != null && path) {
export function provideStorage() {
return new Storage({ name: '__twitter-pwa' });
}
public static initStorage(): Storage {
return new Storage({});
}
export function provideStorage() {
return new Storage({ name: '__wphc' });
}
constructor() {
this.nativeStorage = new NativeStorage();
this.localStorage = new LocalStorage({});
}