Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 17, 2024 via pnpm

caseless 0.11.0

Caseless object set/get/has, very useful when working with HTTP headers.
Package summary
Share
0
issues
1
license
1
Apache-2.0
Package created
13 Sep 2013
Version published
25 Jun 2015
Maintainers
3
Total deps
1
Direct deps
0
License
Apache-2.0

Issues

0
This package has no issues

Licenses

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
1 Packages, Including:
caseless@0.11.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of caseless 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does caseless do?

Caseless is a very useful JavaScript package for working with HTTP headers. It allows you to wrap an object to carry out set, get, and has operations with caseless semantics while preserving the casing of headers when they are first set. This functionality is especially helpful in scenarios where the HTTP headers' case sensitivity might lead to difficulties or confusion.

How do you use caseless?

Using caseless is quite straightforward. You start by importing the package then create an object to store your headers. You wrap this object with the caseless function. Now you can use the .set(key, value), .get(key), .has(key), and .swap(key) methods on this object.

For instance, to set and get a header:

var headers = {};
var c = caseless(headers);

c.set('a-Header', 'asdf');
console.log(c.get('a-header')); // outputs: asdf

To check if a header exists:

console.log(c.has('a-header')); // outputs: a-Header

To append a value to an existing header:

c.set('a-Header', 'fdas');
c.set('a-HEADER', 'more', false);
console.log(c.get('a-header')); // outputs: fdsa,more

To swap the casing of a header:

var headers = {};
var c = caseless(headers);

c.set('a-Header', 'fdas');
c.swap('a-HEADER');
console.log(c.has('a-header')); // outputs: a-HEADER
console.log(headers); // outputs: {'a-HEADER': 'fdas'}

Please note that the set method by default clobbers the value of an existing header if one exists. To append to the existing value, pass false as the third argument.

Where are the caseless docs?

The documentation for Caseless is found within the README file in the package's GitHub repository. The repository's URL is git+https://github.com/mikeal/caseless.git. The README contains usage examples and detailed descriptions of the methods provided by the package.