tsironis / lockr

A minimal API wrapper for localStorage
MIT License
816 stars 79 forks source link

es6 import modules support #33

Open roblav96 opened 8 years ago

roblav96 commented 8 years ago

Recently switching my projects to es6 with babel, I'd like to do something like this with lockr:

import {
    get,
    set,
} from 'lockr'

but when I call get this error throws:

TypeError: Cannot read property '_getPrefixedKey' of undefined
var query_key = this._getPrefixedKey(key, options)

Not a big deal; importing the entire library is not a problem because it's small and minimal.

Thank you =]

tsironis commented 8 years ago

@roblav96 good catch. I've never used Lockr in ES6 env, but I know why it doesn't work. It will require a major refactor on how the lib works under the hood.

roblav96 commented 8 years ago

No worries at all man! Still loving lockr to death haha

tsironis commented 8 years ago

I would appreciate a pull request, if you want to give it a try!