Skip to main content

latest

grep(mini version)

This package works with Deno
This package works with Deno
JSR Score
64%
Published
a year ago (1.0.3)

minigrep

How to use

Arguments need to be passed

  • query --- which want to search
  • filePath --- specify the file

Environment(Optional)

  • IGNORE_CASE --- whether case sensitive
import { ParseConfig, run } from "@iamwxq/minigrep";

try {
  run(ParseConfig.build(Deno.args));
} catch (err) {
  console.error(`Application error: ${err.message}`);
  Deno.exit(1);
}

Example

I'm nobody! Who are you?

Are you nobody, too?

Then there's a pair of us - don't tell!

They'd banish us, you know.

How dreary to be somebody!

How public, like a frog

To tell your name the livelong day

To an admiring bog!

case sensitive:

deno run --allow-env --allow-read main.ts to poem.txt

output:

Are you nobody, too?

How dreary to be somebody!

case insentitive:

IGNORE_CASE=1 && deno run --allow-env --allow-read main.ts to poem.txt

output:

Are you nobody, too?

How dreary to be somebody!

To tell your name the livelong day

To an admiring bog!

Add Package

deno add jsr:@iamwxq/minigrep

Import symbol

import * as minigrep from "@iamwxq/minigrep";

---- OR ----

Import directly with a jsr specifier

import * as minigrep from "jsr:@iamwxq/minigrep";