How to use the jest-docblock.extract function in jest-docblock

To help you get started, we’ve selected a few jest-docblock 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 facebook / metro / packages / metro / src / ModuleGraph / worker / transform-module.js View on Github external
isPolyfill: polyfill || false,
      sourceCode,
    });
  }

  let hasteID = null;
  if (filename.indexOf(NODE_MODULES) === -1 && !polyfill) {
    if (options.hasteImplModulePath != null) {
      // eslint-disable-next-line no-useless-call
      const HasteImpl = (require.call(
        null,
        options.hasteImplModulePath,
      ): HasteImpl);
      hasteID = HasteImpl.getHasteName(filename);
    } else {
      hasteID = docblock.parse(docblock.extract(sourceCode)).providesModule;
    }
  }

  return {
    details: {
      file: filename,
      hasteID: hasteID || null,
      transformed,
      type: options.polyfill ? 'script' : 'module',
    },
    type: 'code',
  };
}
github brodybits / prettierx / src / language-js / pragma.js View on Github external
function hasPragma(text) {
  const pragmas = Object.keys(docblock.parse(docblock.extract(text)));
  return pragmas.indexOf("prettier") !== -1 || pragmas.indexOf("format") !== -1;
}
github dangmai / prettier-plugin-apex / src / pragma.js View on Github external
function hasPragma(text) {
  const pragmas = Object.keys(docblock.parse(docblock.extract(text)));
  return pragmas.indexOf("prettier") !== -1 || pragmas.indexOf("format") !== -1;
}

jest-docblock

`jest-docblock` is a package that can extract and parse a specially-formatted comment called a "docblock" at the top of a file.

MIT
Latest version published 8 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages