@chubbyts/chubbyts-negotiation

3.3.1 • Public • Published

chubbyts-negotiation

CI Coverage Status Mutation testing badge npm-version

bugs code_smells coverage duplicated_lines_density ncloc sqale_rating alert_status reliability_rating security_rating sqale_index vulnerabilities

Description

A simple negotiation library.

Requirements

  • node: 18

Installation

Through NPM as @chubbyts/chubbyts-negotiation.

npm i @chubbyts/chubbyts-negotiation@^3.3.1

Usage

Accept-Language

import { createAcceptLanguageNegotiator } from '@chubbyts/chubbyts-negotiation/dist/accept-language-negotiator';

const negotiator = createAcceptLanguageNegotiator(['en', 'de']);
const value = negotiator.negotiate('de,en;q=0.3,en-US;q=0.7');

Accept

import { createAcceptNegotiator } from '@chubbyts/chubbyts-negotiation/dist/accept-negotiator';

const negotiator = createAcceptNegotiator(['application/json', 'application/xml', 'application/x-yaml']);
const value = negotiator.negotiate('text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q =0.8');

Content-Type

import { createContentTypeNegotiator } from '@chubbyts/chubbyts-negotiation/dist/content-type-negotiator';

const negotiator = createContentTypeNegotiator(['application/json', 'application/xml', 'application/x-yaml']);
const value = negotiator.negotiate('application/xml; charset=UTF-8');

Copyright

2025 Dominik Zogg

/@chubbyts/chubbyts-negotiation/

    Package Sidebar

    Install

    npm i @chubbyts/chubbyts-negotiation

    Weekly Downloads

    156

    Version

    3.3.1

    License

    MIT

    Unpacked Size

    19.3 kB

    Total Files

    15

    Last publish

    Collaborators

    • dominikzogg