Skip to content

Commit

Permalink
feat: Regex of fields ignore whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Oct 17, 2021
1 parent 5f722f9 commit 1f623e4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@secjs/intl",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"license": "MIT",
"author": "João Lenon",
Expand Down
2 changes: 1 addition & 1 deletion resources/locales/pt-br/stub.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"test": "Olá meu nome é {{name}}!"
"test": "Olá meu nome é {{ name }}!"
}
2 changes: 1 addition & 1 deletion src/Sntl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Sntl {

if (fields) {
Object.keys(fields).forEach(k => {
message = message.replace(new RegExp(`{{${k}}}`), fields[k])
message = message.replace(new RegExp(`{{\\s*${k}\\s*}}`), fields[k])
})
}

Expand Down

0 comments on commit 1f623e4

Please sign in to comment.