Skip to content

Commit

Permalink
replace .replace(//g) with a replaceAll
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Jan 31, 2025
1 parent 7f1e1aa commit cc4e223
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### [1.0.2] - 2025-01-30

- replace .replace(//g) with a replaceAll
- prettier: move config into package.json
- dep(eslint): upgrade to v9
- dep(all): bump versions
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ exports.big_company = function (next, connection, helo) {

const allowed_rdns = this.cfg.bigco[helo].split(/,/)
for (const allow of allowed_rdns) {
const re = new RegExp(`${allow.replace(/\./g, '\\.')}$`)
const re = new RegExp(`${allow.replaceAll('.', '\\.')}$`)
if (re.test(rdns)) {
connection.results.add(this, { pass: 'big_co' })
return next()
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ describe('helo.checks', () => {
beforeEach(_set_up)

it('pass, reject=false', (t, done) => {
const test_helo = 'yahoo.com'
this.connection.remote.host = 'yahoo.com'
const test_helo = 'yahoo.co.jp'
this.connection.remote.host = 'yahoo.co.jp'
this.plugin.cfg.check.big_company = true
this.plugin.cfg.reject.big_company = true
this.plugin.big_company(
Expand Down

0 comments on commit cc4e223

Please sign in to comment.