From 3262a76cfd657e4d434460ef0ebff16db049a720 Mon Sep 17 00:00:00 2001 From: ztimson Date: Mon, 7 May 2018 14:33:50 -0400 Subject: [PATCH] Changed syntax in hope of IE fix --- package.json | 2 +- src/webStorage.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 044f8c5..212871f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webstorage-decorators", - "version": "1.0.0", + "version": "1.0.1", "description": "Decorators to sync variable to Local/Session storage", "main": "./lib/index.js", "typings": "./lib/index.d.ts", diff --git a/src/webStorage.ts b/src/webStorage.ts index 6c2266d..16ae814 100644 --- a/src/webStorage.ts +++ b/src/webStorage.ts @@ -6,15 +6,17 @@ export interface WebStorageOptions { defaultValue?: any; } -export function LocalStorage(opts: WebStorageOptions = {}) { +export function LocalStorage(opts: WebStorageOptions) { + if(!opts) opts = {}; return storage(localStorage, opts); } -export function SessionStorage(opts: WebStorageOptions = {}) { +export function SessionStorage(opts: WebStorageOptions) { + if(!opts) opts = {}; return storage(sessionStorage, opts); } -function storage(storageType: Storage, opts: WebStorageOptions = {}) { +function storage(storageType: Storage, opts: WebStorageOptions) { return function(target: object, key: string) { if(!opts.fieldName) opts.fieldName = key;