How to use the fast-memoize.strategies function in fast-memoize

To help you get started, we’ve selected a few fast-memoize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gnosis / dex-contracts / test / utilities.js View on Github external
return obj
}

/**
 * Given a sequence of index1, elements1, ..., indexN elementN this function returns
 * the corresponding MerkleTree of height 7.
 */
const _generateMerkleTree = function(...args) {
  const txs = Array(2 ** 7).fill(sha256(0x0))
  for (let i = 0; i < args.length; i += 2) {
    txs[args[i]] = args[i + 1]
  }
  return new MerkleTree(txs, sha256)
}
const generateMerkleTree = memoize(_generateMerkleTree, {
  strategy: memoize.strategies.variadic,
})

const sendTxAndGetReturnValue = async function(method, ...args) {
  const result = await method.call(...args)
  await method(...args)
  return result
}

/**
 * Partitions array into chunks of size spacing
 * @param input: Array
 * @param spacing: int
 * @returns {Array}
 */
function partitionArray(input, spacing) {
  const output = []

fast-memoize

Fastest memoization lib that supports N arguments

MIT
Latest version published 4 years ago

Package Health Score

73 / 100
Full package analysis

Popular fast-memoize functions

Similar packages