@seges/angular-localstorage
Advanced tools
+5
-5
| { | ||
| "name": "@seges/angular-localstorage", | ||
| "version": "2.0.1", | ||
| "version": "2.1.0", | ||
| "description": "", | ||
@@ -26,5 +26,5 @@ "main": "index.ts", | ||
| "devDependencies": { | ||
| "@types/angular": "^1.6.2", | ||
| "@types/jasmine": "^2.5.41", | ||
| "@types/jquery": "^2.0.39", | ||
| "@types/angular": "1.6.5", | ||
| "@types/jasmine": "2.5.41", | ||
| "@types/jquery": "2.0.39", | ||
| "angular-mocks": "1.6.1", | ||
@@ -35,3 +35,3 @@ "extract-text-webpack-plugin": "1.0.1", | ||
| "istanbul-instrumenter-loader": "0.2.0", | ||
| "jasmine": "2.5.2", | ||
| "jasmine": "2.5.3", | ||
| "jasmine-core": "2.5.2", | ||
@@ -38,0 +38,0 @@ "karma": "1.3.0", |
@@ -10,2 +10,4 @@ import { IStorageService } from "./"; | ||
| } | ||
| removeFromStorage(name: string): void { /* */} | ||
| } |
@@ -44,3 +44,3 @@ import * as angular from "angular"; | ||
| describe("removeFromStorage()", () => { | ||
| describe("getFromStorage()", () => { | ||
| it("should return the data with the given name in localstorage as an object", () => { | ||
@@ -54,2 +54,14 @@ $window.localStorage.getItem = () => { return '{ "name": "test 1" }'; }; | ||
| }); | ||
| describe("removeFromStorage()", () => { | ||
| it("should remove key from localstorage", () => { | ||
| const data = { name: "test 1"}; | ||
| const removeSpy = spyOn($window.localStorage, "removeItem"); | ||
| storageService.saveToStorage("test", data); | ||
| expect(removeSpy).toHaveBeenCalledWith("prefix.test"); | ||
| }); | ||
| }); | ||
| }); |
@@ -8,2 +8,3 @@ import * as angular from "angular"; | ||
| saveToStorage<T>(name: string, data: T): void; | ||
| removeFromStorage(name: string); | ||
| } | ||
@@ -30,2 +31,9 @@ | ||
| } | ||
| /** | ||
| * Remove key and value in localestorage | ||
| */ | ||
| removeFromStorage(name: string): void { | ||
| this.$window.localStorage.removeItem(`${this.prefix}.${name}`); | ||
| } | ||
| } | ||
@@ -32,0 +40,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
9457
7.43%107
17.58%1
Infinity%