Skip to content

Commit

Permalink
build(deps-dev): replace standard with neostandard
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Dec 8, 2024
1 parent a7b664f commit 5f0b27b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[![CI](https://github.com/fastify/accept-negotiator/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/accept-negotiator/actions/workflows/ci.yml)
[![NPM version](https://img.shields.io/npm/v/@fastify/accept-negotiator.svg?style=flat)](https://www.npmjs.com/package/@fastify/accept-negotiator)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)

A negotiator for the accept-headers

Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@
"main": "index.js",
"types": "types/index.d.ts",
"scripts": {
"lint": "standard index.js test/* benchmarks/*",
"lint": "eslint",
"lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",
"test:unit": "c8 --100 node --test",
"test:typescript": "tsd"
},
"standard": {
"ignore": [
"index.d.ts"
]
},
"keywords": [
"encoding",
"negotiator",
Expand All @@ -37,7 +33,7 @@
"@matteo.collina/tspl": "^0.1.1",
"benchmark": "2.1.4",
"c8": "^10.1.2",
"standard": "17.1.2",
"neostandard": "^0.11.9",
"tsd": "^0.31.0"
},
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ declare namespace negotiate {
export class Negotiator<K extends string = string> {
constructor (options: { supportedValues: K[]; cache?: CacheStore })

negotiate(header: string): K | null
negotiate (header: string): K | null
}

export const negotiate: NegotiateFn
export { negotiate as default }
}

declare function negotiate<K extends string = string>(header: string, supportedValues: K[]): K | null;
export = negotiate;
declare function negotiate<K extends string = string> (header: string, supportedValues: K[]): K | null
export = negotiate
12 changes: 6 additions & 6 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { expectError, expectType, expectNotAssignable} from 'tsd'
import { expectError, expectType, expectNotAssignable } from 'tsd'
import { Negotiator, negotiate } from '.'

expectType<Negotiator>(new Negotiator({supportedValues: ['test']}))
expectType<Negotiator>(new Negotiator({supportedValues: ['test'], cache: new Map<string, string>()}))
expectType<(header: string) => ('test' | null)>(new Negotiator({ supportedValues: ['test']}).negotiate)
expectError(new Negotiator({supportedValues: [1]}))
expectType<Negotiator>(new Negotiator({ supportedValues: ['test'] }))
expectType<Negotiator>(new Negotiator({ supportedValues: ['test'], cache: new Map<string, string>() }))
expectType<(header: string) => ('test' | null)>(new Negotiator({ supportedValues: ['test'] }).negotiate)
expectError(new Negotiator({ supportedValues: [1] }))
expectError(new Negotiator())
expectError(new Negotiator(null))
expectError(new Negotiator(undefined))
expectError(new Negotiator({ supportedValues: [], cache: new Map<string, number>() }))

expectType<'gzip' | 'deflate' | null>(negotiate('gzip, br, deflate', ['gzip', 'deflate']))
expectNotAssignable<'gzip'>(negotiate('gzip, br, deflate', ['gzip', 'deflate']))
expectError(negotiate<1>('gzip, br, deflate', ['gzip', 'deflate']))
expectError(negotiate<1>('gzip, br, deflate', ['gzip', 'deflate']))

0 comments on commit 5f0b27b

Please sign in to comment.