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

lodash-lowercasekeys

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash-lowercasekeys

Extend Lodash to take a value and recursively convert all keys to lowercase.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Lodash lowerCaseKeys

Build Status Known Vulnerabilities NPM version code style: prettier

Extend Lodash to take a value and recursively convert all keys to lowercase. This is intended for cleaning up data (usually from a third party) which has inconsistent or unpleasant key naming. Renaming of keys is done recursively (i.e. a 'deep' copy is made) and the input value is left unchanged.

_.lowerCaseKeys(value)

Arguments
value: The array or object value to have it's keys converted. Required.
If a simple value (string, number, etc) is provided it will be returned unchanged.

Returns
(object): An array or object with the keys converted to lowercase.

Example

var _ = require('lodash')
require('lodash-lowerCaseKeys')

_.lowerCaseKeys(
    [
        ['UNCHANGED 1', 'UNCHANGED2', 'THIS WILL BE NOT BE CHANGED'],
        {
            KEY1: 12,
            Age: 44,
            FULLNAME: 'John Smith',
            IsCompetent: false
        },
        {
            KEY1: 13,
            AGE: 29,
            FULLNAME: 'Steven Thomson',
            IsCompetent: true
        },
        {
            Key1: 14,
            Age: 57,
            FullName: 'David Anderson',
            ISCOMPETENT: null,
            HISTORY: [
                {
                    score: 12,
                    timeinSECONDS: 56
                },
                {
                    Score: 14,
                    TIMEINSECONDS: 44
                },
                {
                    SCORE: 17,
                    timeinSECONDS: 80,
                    NOTES: {
                        X: 'This is note 1',
                        y: 'This is note 2',
                        caveatS: {}
                    }
                }
            ]
        }
    ]
)


Returns:


[
    ['UNCHANGED 1', 'UNCHANGED2', 'THIS WILL BE NOT BE CHANGED'],
    {
        key1: 12,
        age: 44,
        fullname: 'John Smith',
        iscompetent: false
    },
    {
        key1: 13,
        age: 29,
        fullname: 'Steven Thomson',
        iscompetent: true
    },
    {
        key1: 14,
        age: 57,
        fullname: 'David Anderson',
        iscompetent: null,
        history: [
            {
                score: 12,
                timeinseconds: 56
            },
            {
                score: 14,
                timeinseconds: 44
            },
            {
                score: 17,
                timeinseconds: 80,
                notes: {
                    x: 'This is note 1',
                    y: 'This is note 2',
                    caveats: {}
                }
            }
        ]
    }
]

Version History

VersionRelease DateDetails
1.0.111th March, 2018Add .prettierrc.
1.0.04th March, 2018Initial release.

FAQs

Package last updated on 11 Mar 2018

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