[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1125074: ITP: node-memoize-one -- Single-entry memoization for function calls



Package: wnpp
Severity: wishlist
Owner: Edward Betts <edward@4angle.com>
X-Debbugs-Cc: debian-devel@lists.debian.org

* Package name    : node-memoize-one
  Version         : 6.0.0
  Upstream Author : Alex Reardon <alexreardon@gmail.com>
* URL             : https://github.com/alexreardon/memoize-one
* License         : MIT
  Programming Lang: JavaScript
  Description     : Single-entry memoization for function calls

  This library wraps a function and caches the result from the most recent
  invocation. When the wrapped function is called again with the same
  arguments, it returns the previously computed value instead of calling the
  original function again.
  .
  Argument comparison is done by checking that the number of arguments is
  unchanged and that each argument is strictly equal to the previous call's
  corresponding argument, with a special case that treats NaN values as equal.
  A custom equality function can be provided to decide whether the new
  argument list matches the previous one.
  .
  The cache is limited to one entry: a new set of arguments replaces the
  previous cached arguments and result. The memoized function also treats
  changes to the calling context (this) as part of the comparison, so calling
  the same function with the same arguments but a different this value causes
  a fresh computation.
  .
  A clear method is attached to the memoized function to discard the stored
  arguments and result. If the original function throws an exception, no
  result is cached for that call and subsequent calls behave as if that
  failing invocation had not been memoized.

This library is a dependancy of Home Assistant, the Python smart home platform.

I plan to maintain it as part of the Home Assistant team.


Reply to: