time-to-botec/squiggle/node_modules/@stdlib/utils/lowercase-keys
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

lowercaseKeys

Convert each object key to lowercase.

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' }