memoize

Memoize functions - an optimization technique used to speed up consecutive function calls by caching the result of calls with identical input

MIT License

Downloads
1M
Stars
1.1K
Committers
18

Bot releases are visible (Hide)

memoize - Latest Release

Published by sindresorhus 11 months ago

Breaking

  • Rename package from mem to memoize 4756892
  • Require Node.js 18 3afdfaf
  • Renamed the memDecorator named import to memoizeDecorator 4756892
  • Renamed the memClear named import to memoizeClear 4756892

https://github.com/sindresorhus/mem/compare/v9.0.2...v10.0.0

memoize -

Published by sindresorhus almost 3 years ago

  • Export missing Options type (#88) 9a937d0

https://github.com/sindresorhus/mem/compare/v9.0.1...v9.0.2

memoize -

Published by sindresorhus over 3 years ago

  • Fix using multiple decorators on the same instance (#78) 7f7ca0a

https://github.com/sindresorhus/mem/compare/v9.0.0...v9.0.1

memoize -

Published by sindresorhus over 3 years ago

Breaking

  • Require Node.js 12.20 (#76) 32c01b1
  • This package is now pure ESM. Please read this.

https://github.com/sindresorhus/mem/compare/v8.1.1...v9.0.0

memoize -

Published by sindresorhus over 3 years ago

  • Don't use the same memoized function across instances when .decorator() is used (#75) d21357c

https://github.com/sindresorhus/mem/compare/v8.1.0...v8.1.1

memoize -

Published by sindresorhus over 3 years ago

  • Add .decorator() method for TypeScript users (#61) 528fa42

https://github.com/sindresorhus/mem/compare/v8.0.0...v8.1.0

memoize -

Published by sindresorhus about 4 years ago

Breaking

  • Convert the package to TypeScript (#64) 0b5c364
    The types might be slightly different than v6.
  • Require Node.js 10 (#67) 1afa53c
  • Throw on .clear(fn) if fn’s cache can't be cleared (#59) e7c8893

https://github.com/sindresorhus/mem/compare/v6.1.1...v8.0.0


What happened to v7? This version was prematurely published as v7, so we did v8 to prevent breaking for those already on v7.

memoize -

Published by sindresorhus about 4 years ago

  • Slightly improve performance (#57) ea88c5c
  • Revert "Automatically use WeakMap when possible" (#58) 3ffde5d

https://github.com/sindresorhus/mem/compare/v6.1.0...v6.1.1

memoize -

Published by sindresorhus over 4 years ago

  • Automatically use WeakMap when possible (#56) e8bb86c

https://github.com/sindresorhus/mem/compare/v6.0.1...v6.1.0

memoize -

Published by fregante almost 5 years ago

  • Support overloaded functions (TypeScript types) (#48) 809697d009059bf177c0d556009eaee121dc2ef6
memoize -

Published by sindresorhus almost 5 years ago

Breaking

  • Simplify the default cacheKey (#43) b7a0766
    It now defaults to cacheKey: x => x instead of the much more complicated previous default. This means it will now only cache the first argument, and only if it's a primitive. Previously, it tried to cache all arguments using JSON.stringify(), but this was both error-prone and slow. This change makes the memoization logic very straightforward, explicit and fast by default. See the readme for how to handle multi-argument or non-primitive value situations.
  • Drop the cachePromiseRejection option (#43) b7a0766
    It was not a good fit for mem and we plan to add it to p-memoize instead (https://github.com/sindresorhus/p-memoize/issues/11), which is like mem, but focused on promises.
  • Throw when .clear() is called with a non-memoized function (#44) c73c23b

https://github.com/sindresorhus/mem/compare/v5.1.1...v6.0.0

memoize -

Published by sindresorhus over 5 years ago

  • Always use an object for the cache item to match expectations and the TypeScript definitions (#42) 1f38c3e

https://github.com/sindresorhus/mem/compare/v5.1.0...v5.1.1

memoize -

Published by sindresorhus over 5 years ago

Enhancements:

  • Minor performance optimization (#39) c098182

https://github.com/sindresorhus/mem/compare/v5.0.0...v5.1.0

memoize -

Published by sindresorhus over 5 years ago

Breaking:

  • Require Node.js 8 e54b59b
  • Change the default value of the cachePromiseRejection option to true (#36) 70707ae
    We decided it's better to default to the least surprising/magic behavior.

Breaking for TypeScript users:

  • Only use a CommonJS export for the TypeScript definition
    You need to change import mem from 'mem'; to import mem = require('mem');

Enhancements:

  • Cache function reference when it's a single argument (#35) 10f13c0

https://github.com/sindresorhus/mem/compare/v4.3.0...v5.0.0

memoize -

Published by sindresorhus over 5 years ago

  • Refactor TypeScript definition to use CJS compatible export (#32) 9a432b9
  • TypeScript - Fix the cache type (#29) 298a71e

https://github.com/sindresorhus/mem/compare/v4.2.0...v4.3.0

memoize -

Published by sindresorhus over 5 years ago

  • Add TypeScript definition (#28) 6887496

https://github.com/sindresorhus/mem/compare/v4.1.0...v4.2.0

memoize -

Published by sindresorhus over 5 years ago

  • Work around some host environments throwing on mimicFn call (#26) e08ad85
  • Bump dependencies bdfc93a

https://github.com/sindresorhus/mem/compare/v4.0.0...v4.1.0

Package Rankings
Top 2.13% on Npmjs.org