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

caseless-proxy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caseless-proxy

Create ES6 proxy object with case-insensitive properties

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

caseless-proxy

Create ES6 proxy object with case-insensitive properties.

This library has similar semantics to the caseless library but is implemented as a proxy object. This way native javascript constructs can be used to get/set/delete properties in a case insensitive manner.

Objects created with this library behave exactly like normal javascript objects with the exception that property access happens in a case insensitive way.

Build Status

Usage

caseless:

var headers = {};
var c = caseless(headers);
c.set('a-Header', 'asdf');
c.get('a-header') === 'asdf';

caseless-proxy:

var headers = {};
var c = caselessProxy(headers);
c['a-Header'] = 'asdf';
c['a-header'] === 'asdf';

caseless:

c.has('a-header') === 'a-Header'

caseless-proxy:

'a-header' in c

caseless:

var headers = {};
var c = caseless(headers);
c.set('a-Header', 'fdas');
c.swap('a-HEADER');
c.has('a-header') === 'a-HEADER';
headers === {'a-HEADER': 'fdas'};

caseless-proxy:

var headers = {};
var c = caselessProxy(headers);
c['a-Header'] = 'asdf';
function swap (caseless, property) {
  let tmp = caseless[property];
  delete caseless[property];
  caseless[property] = tmp;
}
swap(c, 'a-HEADER');
headers === {'a-HEADER': 'fdas'};

API

caselessProxy( [Object target] );

Creates a proxy to the target object with case insensitive property access. Will create a new object when target is omitted.

Keywords

FAQs

Package last updated on 15 Aug 2016

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