JSPM

grob

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 98
  • Score
    100M100P100Q60742F
  • License MIT

grep, but in JavaScript.

Package Exports

  • grob

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (grob) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

grob

grep, but in JavaScript.

  • Supports globs using [fast-glob]
  • Faster than grep™†

† Only faster than grep when you are already inside a Node process and would have to spawn a child process to run grep and then parse out the results.

Install

yarn add [--dev] grob

Example

const grob = require('grob');

let matches = await grob({
  cwd: __dirname,
  globs: ['src/**/*.js', '!**/node_modules'],
  regex: /findme/,
});
// Map {
//   "src/index.js" => [{
//     filePath: "/path/to/src/index.js",
//     line: 13,
//     start: 12,
//     end: 18,
//     lineContents: 'console.log(findme);'
//   }]
//   ...
// }