Socket
Socket
Sign inDemoInstall

caseless-proxy

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    caseless-proxy

Create ES6 proxy object with case-insensitive properties


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
10.4 kB
Created
Weekly downloads
 

Readme

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

Last updated on 15 Aug 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc