How to use the @emotion/weak-memoize.default function in @emotion/weak-memoize

To help you get started, we’ve selected a few @emotion/weak-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 keystonejs / keystone / website / plugins / gatsby-remark-fix-links / index.js View on Github external
//     key = link.startsWith('#') ? path : link.slice(0, hashIndex);
//   }
//   return {
//     key,
//     hasHash,
//     hashIndex,
//   };
// }
// function createPathPrefixer(pathPrefix) {
//   return function withPathPrefix(url) {
//     const prefixed = pathPrefix + url;
//     return prefixed.replace(/\/\//, '/');
//   };
// }

let buildFilenameToUrlMap = weakMemoize(getNode =>
  weakMemoize(files => {
    let map = {};

    for (let file of files) {
      if (file.children.length === 2) {
        map[file.absolutePath] = getNode(file.children[1]).fields.slug;
      }
    }
    return map;
  })
);

module.exports = async function plugin(
  { markdownAST, markdownNode, files, getNode, cache, getCache, pathPrefix } // { exceptions = [], ignore = [] } = {}
) {
  if (!markdownNode.fields) {

@emotion/weak-memoize

A memoization function that uses a WeakMap

MIT
Latest version published 4 months ago

Package Health Score

83 / 100
Full package analysis

Popular @emotion/weak-memoize functions

Similar packages