1.1.2 • Published 5 years ago

str-fragment v1.1.2

Weekly downloads
12
License
ISC
Repository
github
Last release
5 years ago

str-replace

Capture text fragments based on regular expressions that are executed for each line of the text, ex:

import { getFragments, replaceFragments, walkFragments } from "str-fragment";

let str = `
/**
 * old comment
 */
let s = "";
`;

/**@type {import("str-fragment/internal").captures}*/
let fragments = getFragment(str, {
  open: /\/\*\*/,
  closed: /\*\//,
});

replaceFragments(str, fragments, () => `/** new comment */`);
// /** new comment */
// let s = "";

replaceFragments

Replace the fragments with a new text, if null returns no replacement of the evaluated fragment is generated

walkFragments

Walk on the shards generate changes

1.1.1

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago