Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

caseless

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caseless

Caseless object set/get/has, very useful when working with HTTP headers.

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17M
increased by4.28%
Maintainers
1
Weekly downloads
 
Created

What is caseless?

The caseless npm package is a utility for managing HTTP headers in a case-insensitive manner. It allows you to get, set, and delete headers on an object without worrying about the case sensitivity of the header names.

What are caseless's main functionalities?

Setting headers

This feature allows you to set headers on an object. The headers are managed in a case-insensitive way, so setting 'A-Header' would overwrite 'a-header' if it already exists.

{"var caseless = require('caseless');\nvar headers = {};\nvar c = caseless(headers);\nc.set('a-Header', 'the value');\nconsole.log(headers); // Output will be { 'a-header': 'the value' }"}

Getting headers

This feature allows you to retrieve the value of headers regardless of the case of the header name you provide.

{"var caseless = require('caseless');\nvar headers = {'a-header': 'the value'};\nvar c = caseless(headers);\nconsole.log(c.get('A-Header')); // Output will be 'the value'"}

Checking if a header exists

This feature allows you to check if a header exists in the object, regardless of the case of the header name.

{"var caseless = require('caseless');\nvar headers = {'content-type': 'application/json'};\nvar c = caseless(headers);\nconsole.log(c.has('Content-Type')); // Output will be true"}

Deleting headers

This feature allows you to delete headers from the object. The deletion is case-insensitive.

{"var caseless = require('caseless');\nvar headers = {'content-type': 'application/json'};\nvar c = caseless(headers);\nc.delete('Content-Type');\nconsole.log(headers); // Output will be {}"}

Other packages similar to caseless

Keywords

FAQs

Package last updated on 19 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc