aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-03-24 09:09:17 +0100
committerGitHub <[email protected]>2022-03-24 09:09:17 +0100
commit301a6d2024816bf40f1091ccffe6bb81cb7ba7b0 (patch)
treeb7a411559aa1dfa28297566603a47bba95e90b56 /src
parent9ce1551ab7c9cafc97e3d051f0632591e34eb3ce (diff)
downloadfaker-301a6d2024816bf40f1091ccffe6bb81cb7ba7b0.tar.xz
faker-301a6d2024816bf40f1091ccffe6bb81cb7ba7b0.zip
fix: fake is unable to return empty strings (#347)
Diffstat (limited to 'src')
-rw-r--r--src/fake.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fake.ts b/src/fake.ts
index 726bf896..4261ebeb 100644
--- a/src/fake.ts
+++ b/src/fake.ts
@@ -116,6 +116,10 @@ export class Fake {
// replace the found tag with the returned fake value
res = str.replace('{{' + token + '}}', result);
+ if (res === '') {
+ return '';
+ }
+
// return the response recursively until we are done finding all tags
return this.fake(res);
}