Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export function registerPricing(provider: string, model: string, pricing: ModelP
if (!pricing || typeof pricing !== 'object') {
throw new Error('TokenFirewall: Pricing must be an object');
}
if (typeof pricing.input !== 'number' || pricing.input < 0 || !isFinite(pricing.input) || isNaN(pricing.input)) {
if (typeof pricing.input !== 'number' || pricing.input < 0 || !isFinite(pricing.input) || Number.isNaN(pricing.input)) {
throw new Error('TokenFirewall: Pricing input must be a non-negative finite number');
}
if (typeof pricing.output !== 'number' || pricing.output < 0 || !isFinite(pricing.output) || isNaN(pricing.output)) {
if (typeof pricing.output !== 'number' || pricing.output < 0 || !isFinite(pricing.output) || Number.isNaN(pricing.output)) {
throw new Error('TokenFirewall: Pricing output must be a non-negative finite number');
}

Expand All @@ -90,7 +90,7 @@ export function registerContextLimit(provider: string, model: string, contextLim
if (!model || typeof model !== 'string' || model.trim() === '') {
throw new Error('TokenFirewall: Model must be a non-empty string');
}
if (typeof contextLimit !== 'number' || contextLimit <= 0 || !isFinite(contextLimit) || isNaN(contextLimit)) {
if (typeof contextLimit !== 'number' || contextLimit <= 0 || !isFinite(contextLimit) || Number.isNaN(contextLimit)) {
throw new Error('TokenFirewall: Context limit must be a positive finite number');
}

Expand Down