MichalZalecki / storage-factory

Because using localStorage directly is a bad idea
https://www.npmjs.com/package/storage-factory
63 stars 5 forks source link

feature/length implementation #1

Closed whatisboom closed 6 years ago

whatisboom commented 6 years ago

Decided to tackle this. I converted to a class which would update the usage a tiny bit, but makes the length implementation much easier. I could add a wrapper function around the new class if you'd like to maintain usage consistency.

MichalZalecki commented 6 years ago

@whatisboom Thanks for your interest and this PR. Personally I prefer to go with functions but this isn't so important as the fact that I can enforce returned object to be of Storage type. Not everyone are using TypeScript so I would like to keep inMemoryStorage in the closure.

Would be so kind and make such PR adding length but keeping storageFactory a function?

whatisboom commented 6 years ago

@MichalZalecki how do you feel about this solution? usage stays the same, and uses the class under the hood. If this isn't acceptable I can work on a solution with just functions and objects