Fixed localStorage access on node environments
This commit is contained in:
		
							
								
								
									
										5184
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										5184
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "@ztimson/utils",
 | 
						"name": "@ztimson/utils",
 | 
				
			||||||
	"version": "0.20.3",
 | 
						"version": "0.20.4",
 | 
				
			||||||
	"description": "Utility library",
 | 
						"description": "Utility library",
 | 
				
			||||||
	"author": "Zak Timson",
 | 
						"author": "Zak Timson",
 | 
				
			||||||
	"license": "MIT",
 | 
						"license": "MIT",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ export class Cache<K extends string | number | symbol, T> {
 | 
				
			|||||||
	 * @param options
 | 
						 * @param options
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	constructor(public readonly key?: keyof T, public readonly options: CacheOptions = {}) {
 | 
						constructor(public readonly key?: keyof T, public readonly options: CacheOptions = {}) {
 | 
				
			||||||
		if(options.storageKey && !options.storage)
 | 
							if(options.storageKey && !options.storage && localStorage)
 | 
				
			||||||
			options.storage = localStorage;
 | 
								options.storage = localStorage;
 | 
				
			||||||
		if(options.storageKey && options.storage) {
 | 
							if(options.storageKey && options.storage) {
 | 
				
			||||||
			const stored = options.storage.getItem(options.storageKey);
 | 
								const stored = options.storage.getItem(options.storageKey);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user