diff --git a/package.json b/package.json index d4b3690..0e5099f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shubhodeep9/localstorm", - "version": "0.0.1", + "version": "0.0.2", "description": "An ORM for localstorage", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -12,9 +12,17 @@ "orm", "triggers" ], + "repository": { + "type": "git", + "url": "git+https://github.com/shubhodeep9/localstorm.git" + }, "author": "Shubhodeep Mukherjee", - "license": "ISC", + "license": "MIT", "dependencies": { "typescript": "^4.9.3" - } + }, + "bugs": { + "url": "https://github.com/shubhodeep9/localstorm/issues" + }, + "homepage": "https://github.com/shubhodeep9/localstorm#readme" } diff --git a/src/entity/entry.ts b/src/entity/entry.ts index 5bcbdee..184d1dd 100644 --- a/src/entity/entry.ts +++ b/src/entity/entry.ts @@ -23,14 +23,16 @@ export class Entry { } } - save(saveObj: any) { + save(saveObj: Object) { this.validate(saveObj); - window.localStorage.setItem(this.key, saveObj); + window.localStorage.setItem(this.key, JSON.stringify(saveObj)); } get() { - return window.localStorage.getItem(this.key); + const obj = window.localStorage.getItem(this.key); + if (!obj) return obj; + return JSON.parse(obj); } flush() {