🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
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

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
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

caseless

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