Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Don't work with lodash.memoize #319

Open
inomdzhon opened this issue Oct 24, 2018 · 0 comments
Open

Don't work with lodash.memoize #319

inomdzhon opened this issue Oct 24, 2018 · 0 comments

Comments

@inomdzhon
Copy link

inomdzhon commented Oct 24, 2018

I'm caching Intl.NumberFormat instance like next

import { memoize } from 'lodash';

const IntlNumberFormat = memoize(Intl.NumberFormat, (...args) => JSON.stringify(args));

Without polyfill all work correctly, but with polyfill I got error .format() is not a function.

And I really don't understand why we need this condition? 😃

if (!this || this === Intl$1) {

I think this creates a problem with memoize (https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L10539)

We already check for Intl exist here

if (typeof Intl === 'undefined') {

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant