Socket
Socket
Sign inDemoInstall

obj-case

Package Overview
Dependencies
0
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    obj-case

Work with objects of different cased keys


Version published
Weekly downloads
534K
increased by2.69%
Maintainers
2
Install size
14.8 kB
Created
Weekly downloads
 

Readme

Source

obj-case

Work with objects of different cased keys. Anything supported by nbubna/Case. Makes finding and editing objects between languages a little more forgiving while still not modifying the original JSON.

Build Status

Installation

Install with component(1):

$ component install segmentio/obj-case

API

.find(obj, key)

Returns the value for the object with the given key

var obj = { my : { super_cool : { climbingShoes : 'x' }}};
objCase.find(obj, 'my.superCool.CLIMBING SHOES');  // 'x'

.del(obj, key, val, [options])

Deletes a nested key

var obj = { 'a wild' : { mouse : { APPEARED : true }}};
objCase.del(obj, 'aWild.mouse.appeared');
console.log(obj); // { 'a wild' : { mouse : {} }}

.replace(obj, key, val, [options])

Replaces a nested key's value

var obj = { replacing : { keys : 'is the best' }};
objCase.replace(obj, 'replacing.keys', 'is just okay');
console.log(obj) // { replacing : { keys : 'is just okay' }}

License

MIT

Keywords

FAQs

Last updated on 25 May 2021

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc