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

2.5 KiB

uppercaseKeys

Convert each object key to uppercase.

Usage

var uppercaseKeys = require( '@stdlib/utils/uppercase-keys' );

uppercaseKeys( obj )

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

var obj1 = {
    'a': 1,
    'b': 2
};

var obj2 = uppercaseKeys( 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 uppercaseKeys = require( '@stdlib/utils/uppercase-keys' );

var obj1 = {
    'a': 'beep',
    'b': 'boop',
    'c': 'foo',
    'd': 'bar'
};

var obj2 = uppercaseKeys( obj1 );

console.dir( obj2 );
// => { 'A': 'beep', 'B': 'boop', 'C': 'foo', 'D': 'bar' }