Skip to content

Commit

Permalink
perf: ⚡️ add isDefineStorage check (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
bingryan authored Apr 23, 2023
1 parent 0d9c01f commit 2cd0a1a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function isDefineStorage(tp: string): tp is StorageTypeList {
}

function createStorage(): StorageClass {
if (!isDefineStorage(defineStorageType)) {
throw new Error(`not support ${defineStorageType} storage`);
}
switch (defineStorageType) {
case 'window.localStorage':
return wls;
Expand Down

0 comments on commit 2cd0a1a

Please sign in to comment.