Skip to content

Commit

Permalink
docs(core): add toString method for returning string (#13757)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiagatra committed Dec 14, 2022
1 parent c461488 commit 437a3eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/shared/generators/modifying-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Let's say we want to replace any instance of `thomasEdison` with `nikolaTesla` i
```typescript
export default async function (tree: Tree, schema: any) {
const filePath = `path/to/index.ts`;
const contents = tree.read(filePath);
const contents = tree.read(filePath).toString();
contents.replace('thomasEdison', 'nikolaTesla');
tree.write(filePath, contents);
}
Expand All @@ -47,7 +47,7 @@ This works, but only replaces the first instance of `thomasEdison`. To replace t
```typescript
export default async function (tree: Tree, schema: any) {
const filePath = `path/to/index.ts`;
const contents = tree.read(filePath);
const contents = tree.read(filePath).toString();
contents.replace(/thomasEdison/g, 'nikolaTesla');
tree.write(filePath, contents);
}
Expand Down

1 comment on commit 437a3eb

@vercel
Copy link

@vercel vercel bot commented on 437a3eb Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx.dev
nx-dev-git-master-nrwl.vercel.app

Please sign in to comment.