Skip to content

Commit

Permalink
chore: remove pluralizer (#3586)
Browse files Browse the repository at this point in the history
* rewrite pluralizer

* remove pluralizer
  • Loading branch information
Uzlopak authored Sep 12, 2024
1 parent 990df2c commit 070323c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 37 deletions.
13 changes: 5 additions & 8 deletions lib/mock/mock-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const MockPool = require('./mock-pool')
const { matchValue, buildMockOptions } = require('./mock-utils')
const { InvalidArgumentError, UndiciError } = require('../core/errors')
const Dispatcher = require('../dispatcher/dispatcher')
const Pluralizer = require('./pluralizer')
const PendingInterceptorsFormatter = require('./pending-interceptors-formatter')

class MockAgent extends Dispatcher {
Expand Down Expand Up @@ -147,13 +146,11 @@ class MockAgent extends Dispatcher {
return
}

const pluralizer = new Pluralizer('interceptor', 'interceptors').pluralize(pending.length)

throw new UndiciError(`
${pluralizer.count} ${pluralizer.noun} ${pluralizer.is} pending:
${pendingInterceptorsFormatter.format(pending)}
`.trim())
throw new UndiciError(
pending.length === 1
? `1 interceptor is pending:\n\n${pendingInterceptorsFormatter.format(pending)}`.trim()
: `${pending.length} interceptors are pending:\n\n${pendingInterceptorsFormatter.format(pending)}`.trim()
)
}
}

Expand Down
29 changes: 0 additions & 29 deletions lib/mock/pluralizer.js

This file was deleted.

0 comments on commit 070323c

Please sign in to comment.