@stdlib/utils-lowercase-keys
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.7 • Public • Published

    lowercaseKeys

    NPM version Build Status Coverage Status dependencies

    Convert each object key to lowercase.

    Installation

    npm install @stdlib/utils-lowercase-keys

    Usage

    var lowercaseKeys = require( '@stdlib/utils-lowercase-keys' );

    lowercaseKeys( obj )

    Converts each object key to lowercase, mapping the transformed keys to a new object having the same values.

    var obj1 = {
        'A': 1,
        'B': 2
    };
    
    var obj2 = lowercaseKeys( obj1 );
    // returns { 'a': 1, 'b': 2 }

    Notes

    • The function only transforms own properties. Hence, the function does not transform inherited properties.
    • The function shallow copies key values.

    Examples

    var lowercaseKeys = require( '@stdlib/utils-lowercase-keys' );
    
    var obj1 = {
        'A': 'beep',
        'B': 'boop',
        'C': 'foo',
        'D': 'bar'
    };
    
    var obj2 = lowercaseKeys( obj1 );
    
    console.dir( obj2 );
    // => { 'a': 'beep', 'b': 'boop', 'c': 'foo', 'd': 'bar' }

    Notice

    This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

    For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

    Community

    Chat


    License

    See LICENSE.

    Copyright

    Copyright © 2016-2021. The Stdlib Authors.

    Install

    npm i @stdlib/utils-lowercase-keys

    Homepage

    stdlib.io

    DownloadsWeekly Downloads

    8

    Version

    0.0.7

    License

    Apache-2.0

    Unpacked Size

    35.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • stdlib-bot
    • kgryte
    • planeshifter
    • rreusser