marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.01k stars 1.33k forks source link

IE11 isFunction exception when loading plugins #252

Open mikelovesrobots opened 6 years ago

mikelovesrobots commented 6 years ago

Hey there,

I appreciate your work on the library!

When running on IE11 (not edge) and requiring('store'), I'm seeing exceptions in store-engine.js when loading plugins.

        // Check that the plugin is properly formed
        if (!isFunction(plugin)) {
            throw new Error('Plugins must be function values that return objects')
        }

Hovering over plugin in the debugger reveals that it's "function json2plugin(), which sounds good, could really be a function. But when I step intoisFunction` (in util.js):

function isFunction(val) {
    return val && {}.toString.call(val) === '[object Function]'
}

I see that {}.toString.call(val) is actually returning an "[object Array iterator]" and not an [object Function]. I wonder if I need to do some sort of polyfill. But maybe that shouldn't be necessary because this is supported back to ie8, right?

Like most developers, we're running a semi-complicated mix of webpack and babel. I believe that all we're doing to the store.js library is smooshing it down into a single file along with the rest of our node_modules, but there might be more going on behind the scenes peculiar to our particular install.

Any ideas or suggestions would be welcome. Thanks!

georgebonnr commented 6 years ago

We're also running into this issue!