grob

grep, but in JavaScript.

  • grob

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
grob
7201.0.04 years ago4 years agoMinified + gzip package size for grob in KB

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);'
//   }]
//   ...
// }