Skip to content

Commit

Permalink
feat: add findValueBetween()
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Aug 17, 2024
1 parent 992f55c commit 3fd7c14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { splitCookiesString } from "set-cookie-parser";

export const findValueBetween = (plain: string, start: string, end: string): string => {
const startIndex = plain.indexOf(start) + start.length;
const endIndex = plain.indexOf(end, startIndex);
return plain.slice(startIndex, endIndex);
};

interface HeadersLike {
get (key: string): string | null
};
Expand Down

0 comments on commit 3fd7c14

Please sign in to comment.