{
  "_id": "@tinyhttp/vary",
  "maintainers": [
    {
      "email": "hi@v1rtl.site",
      "name": "dropthebeatbro"
    },
    {
      "email": "npmjs.uyolv@fastmail.com",
      "name": "v1rtl"
    }
  ],
  "keywords": [
    "http",
    "esm",
    "es",
    "vary",
    "nodejs",
    "javascript"
  ],
  "dist-tags": {
    "latest": "0.1.3"
  },
  "author": {
    "name": "v1rtl",
    "email": "hi@v1rtl.site"
  },
  "_rev": "2-8b38f4bd539fe6c196f241a96af87545",
  "description": "vary rewrite in TypeScript and ESM",
  "readme": "# @tinyhttp/vary\n\n[![Version][v-badge-url]][npm-url] [![Downloads][dl-badge-url]][npm-url] [![GitHub Workflow Status][gh-actions-img]][github-actions] [![Codecov][cov-badge-url]][cov-url]\n\n> [`vary`](https://github.com/jshttp/vary) rewrite in TypeScript with ESM and CommonJS targets\n\nManipulate the HTTP Vary header\n\n## Install\n\n```sh\npnpm i @tinyhttp/vary\n```\n\n## API\n\n```ts\nimport { vary, append } from '@tinyhttp/vary'\n```\n\n### `vary(res, field)`\n\nAdds the given header `field` to the `Vary` response header of `res`.\nThis can be a string of a single field, a string of a valid `Vary`\nheader, or an array of multiple fields.\n\nThis will append the header if not already listed, otherwise leaves\nit listed in the current location.\n\n```ts\nvary(res, 'Origin')\n```\n\n### `append(header, field)`\n\nAdds the given header `field` to the `Vary` response header string `header`.\nThis can be a string of a single field, a string of a valid `Vary` header,\nor an array of multiple fields.\n\nThis will append the header if not already listed, otherwise leaves\nit listed in the current location. The new header string is returned.\n\n```ts\n// Get header string appending \"Origin\" to \"Accept, User-Agent\"\nappend('Accept, User-Agent', 'Origin')\n```\n\n## Examples\n\n```ts\nimport { createServer } from 'node:http'\nimport { vary } from '@tinyhttp/vary'\n\ncreateServer((req, res) => {\n  // about to user-agent sniff\n  vary(res, 'User-Agent')\n\n  const ua = req.headers['user-agent'] || ''\n  const isMobile = /mobi|android|touch|mini/i.test(ua)\n\n  // serve site, depending on isMobile\n  res.setHeader('Content-Type', 'text/html')\n  res.end('You are (probably) ' + (isMobile ? '' : 'not ') + 'a mobile user')\n})\n```\n\n## License\n\nMIT © [v1rtl](https://v1rtl.site)\n\n[v-badge-url]: https://img.shields.io/npm/v/@tinyhttp/vary.svg?style=for-the-badge&color=FF69B4&label=&logo=npm\n[npm-url]: https://www.npmjs.com/package/@tinyhttp/vary\n[cov-badge-url]: https://img.shields.io/coveralls/github/tinyhttp/vary?style=for-the-badge&color=FF69B4\n[cov-url]: https://coveralls.io/github/tinyhttp/vary\n[dl-badge-url]: https://img.shields.io/npm/dt/@tinyhttp/vary?style=for-the-badge&color=FF69B4\n[github-actions]: https://github.com/tinyhttp/vary/actions\n[gh-actions-img]: https://img.shields.io/github/actions/workflow/status/tinyhttp/vary/main.yml?branch=master&style=for-the-badge&color=FF69B4&label=&logo=github\n",
  "repository": {
    "url": "git+https://github.com/tinyhttp/vary.git",
    "type": "git"
  },
  "bugs": {
    "url": "https://github.com/tinyhttp/vary/issues"
  },
  "license": "MIT",
  "versions": {
    "0.1.3": {
      "name": "@tinyhttp/vary",
      "version": "0.1.3",
      "keywords": [
        "http",
        "esm",
        "es",
        "vary",
        "nodejs",
        "javascript"
      ],
      "author": {
        "name": "v1rtl",
        "email": "hi@v1rtl.site"
      },
      "license": "MIT",
      "_id": "@tinyhttp/vary@0.1.3",
      "maintainers": [
        {
          "name": "dropthebeatbro",
          "email": "hi@v1rtl.site"
        }
      ],
      "homepage": "https://github.com/tinyhttp/vary#readme",
      "bugs": {
        "url": "https://github.com/tinyhttp/vary/issues"
      },
      "dist": {
        "shasum": "f5bea4769f380c43a158832a8daad8e8b186757c",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@tinyhttp/vary/-/vary-0.1.3.tgz",
        "fileCount": 5,
        "integrity": "sha512-SoL83sQXAGiHN1jm2VwLUWQSQeDAAl1ywOm6T0b0Cg1CZhVsjoiZadmjhxF6FHCCY7OHHVaLnTgSMxTPIDLxMg==",
        "signatures": [
          {
            "sig": "MEUCIQDfRkOfSfhFJlGC9rAGHt7q6kLwm4h4YQDDPdMcQiZElgIgZ1fFK4yqk7RfVSfdwMkR490GXb7pi86aKYqTS20FFYE=",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 6013
      },
      "type": "module",
      "_from": "file:tinyhttp-vary-0.1.3.tgz",
      "types": "dist/index.d.ts",
      "engines": {
        "node": ">=12.20"
      },
      "exports": "./dist/index.js",
      "scripts": {
        "test": "tsm node_modules/uvu/bin.js test",
        "build": "tsup src/index.ts --minify-whitespace --format esm --dts",
        "test:report": "c8 report --reporter=text-lcov > coverage.lcov",
        "test:coverage": "c8 --include=src pnpm test"
      },
      "_npmUser": {
        "name": "dropthebeatbro",
        "email": "hi@v1rtl.site"
      },
      "_resolved": "/tmp/de81d32500e1ceefd3228b00fa9797d3/tinyhttp-vary-0.1.3.tgz",
      "_integrity": "sha512-SoL83sQXAGiHN1jm2VwLUWQSQeDAAl1ywOm6T0b0Cg1CZhVsjoiZadmjhxF6FHCCY7OHHVaLnTgSMxTPIDLxMg==",
      "repository": {
        "url": "git+https://github.com/tinyhttp/vary.git",
        "type": "git"
      },
      "_npmVersion": "10.1.0",
      "description": "vary rewrite in TypeScript and ESM",
      "directories": {},
      "_nodeVersion": "20.7.0",
      "publishConfig": {
        "access": "public"
      },
      "_hasShrinkwrap": false,
      "devDependencies": {
        "c8": "^8.0.1",
        "tsm": "^2.3.0",
        "uvu": "^0.5.6",
        "tsup": "^7.2.0",
        "typescript": "^5.2.2",
        "@types/node": "^20.7.1",
        "@typescript-eslint/parser": "^6.7.3",
        "@typescript-eslint/eslint-plugin": "^6.7.3"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/vary_0.1.3_1695919670074_0.40368593904954175",
        "host": "s3://npm-registry-packages"
      }
    }
  },
  "name": "@tinyhttp/vary",
  "time": {
    "created": "2023-09-28T16:47:49.961Z",
    "modified": "2026-05-23T14:14:19.519Z",
    "0.1.3": "2023-09-28T16:47:50.235Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/tinyhttp/vary#readme"
}