README.md (2573B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # uppercaseKeys 22 23 > Convert each object key to uppercase. 24 25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 26 27 <section class="intro"> 28 29 </section> 30 31 <!-- /.intro --> 32 33 <!-- Package usage documentation. --> 34 35 <section class="usage"> 36 37 ## Usage 38 39 ```javascript 40 var uppercaseKeys = require( '@stdlib/utils/uppercase-keys' ); 41 ``` 42 43 #### uppercaseKeys( obj ) 44 45 Converts each `object` key to uppercase, mapping the transformed keys to a new `object` having the same values. 46 47 ```javascript 48 var obj1 = { 49 'a': 1, 50 'b': 2 51 }; 52 53 var obj2 = uppercaseKeys( obj1 ); 54 // returns { 'A': 1, 'B': 2 } 55 ``` 56 57 </section> 58 59 <!-- /.usage --> 60 61 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 62 63 <section class="notes"> 64 65 ## Notes 66 67 - The function only transforms **own** properties. Hence, the function does **not** transform inherited properties. 68 - The function **shallow** copies key values. 69 70 </section> 71 72 <!-- /.notes --> 73 74 <!-- Package usage examples. --> 75 76 <section class="examples"> 77 78 ## Examples 79 80 <!-- eslint no-undef: "error" --> 81 82 ```javascript 83 var uppercaseKeys = require( '@stdlib/utils/uppercase-keys' ); 84 85 var obj1 = { 86 'a': 'beep', 87 'b': 'boop', 88 'c': 'foo', 89 'd': 'bar' 90 }; 91 92 var obj2 = uppercaseKeys( obj1 ); 93 94 console.dir( obj2 ); 95 // => { 'A': 'beep', 'B': 'boop', 'C': 'foo', 'D': 'bar' } 96 ``` 97 98 </section> 99 100 <!-- /.examples --> 101 102 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 103 104 <section class="references"> 105 106 </section> 107 108 <!-- /.references --> 109 110 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 111 112 <section class="links"> 113 114 </section> 115 116 <!-- /.links -->