From 1d8d8132f3d02706b39ede23c26db4fcfbebc91e Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Wed, 24 Dec 2025 19:51:54 +0530 Subject: [PATCH 1/4] feat: add `object/uppercase-keys` Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/object/uppercase-keys/README.md | 139 +++++++++++++ .../uppercase-keys/benchmark/benchmark.js | 57 ++++++ .../object/uppercase-keys/docs/repl.txt | 28 +++ .../uppercase-keys/docs/types/index.d.ts | 46 +++++ .../object/uppercase-keys/docs/types/test.ts | 33 +++ .../object/uppercase-keys/examples/index.js | 33 +++ .../object/uppercase-keys/lib/index.js | 45 +++++ .../@stdlib/object/uppercase-keys/lib/main.js | 63 ++++++ .../object/uppercase-keys/package.json | 74 +++++++ .../object/uppercase-keys/test/test.js | 191 ++++++++++++++++++ 10 files changed, 709 insertions(+) create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/README.md create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/examples/index.js create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/lib/index.js create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/lib/main.js create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/package.json create mode 100644 lib/node_modules/@stdlib/object/uppercase-keys/test/test.js diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/README.md b/lib/node_modules/@stdlib/object/uppercase-keys/README.md new file mode 100644 index 000000000000..eb49668c4fa5 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/README.md @@ -0,0 +1,139 @@ + + +# uppercaseKeys + +> Convert each object key to uppercase. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var uppercaseKeys = require( '@stdlib/object/uppercase-keys' ); +``` + +#### uppercaseKeys( obj ) + +Converts each `object` key to uppercase, mapping the transformed keys to a new `object` having the same values. + +```javascript +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 + + + +```javascript +var uppercaseKeys = require( '@stdlib/object/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' } +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/benchmark/benchmark.js b/lib/node_modules/@stdlib/object/uppercase-keys/benchmark/benchmark.js new file mode 100644 index 000000000000..7883aefc334d --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/benchmark/benchmark.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var randu = require( '@stdlib/random/base/randu' ); +var pkg = require( './../package.json' ).name; +var uppercaseKeys = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var obj; + var out; + var i; + + obj = { + 'a': 'beep', + 'b': 'boop', + 'c': 'foo', + 'd': 'bar', + 'e': randu() + }; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + obj.e = randu(); + out = uppercaseKeys( obj ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/docs/repl.txt b/lib/node_modules/@stdlib/object/uppercase-keys/docs/repl.txt new file mode 100644 index 000000000000..d2f8f8cd68bd --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( obj ) + Converts each object key to uppercase. + + The function only transforms own properties. Hence, the function does not + transform inherited properties. + + The function shallow copies key values. + + Parameters + ---------- + obj: Object + Source object. + + Returns + ------- + out: Object + New object. + + Examples + -------- + > var obj = { 'a': 1, 'b': 2 }; + > var out = {{alias}}( obj ) + { 'A': 1, 'B': 2 } + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/docs/types/index.d.ts b/lib/node_modules/@stdlib/object/uppercase-keys/docs/types/index.d.ts new file mode 100644 index 000000000000..5725878a5238 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/docs/types/index.d.ts @@ -0,0 +1,46 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Converts each object key to uppercase. +* +* ## Notes +* +* - The function only transforms own properties. Hence, the function does not transform inherited properties. +* - The function shallow copies key values. +* +* @param obj - source object +* @returns new object +* +* @example +* var obj1 = { +* 'a': 1, +* 'b': 2 +* }; +* +* var obj2 = uppercaseKeys( obj1 ); +* // returns { 'A': 1, 'B': 2 } +*/ +declare function uppercaseKeys( obj: Object ): Object; + + +// EXPORTS // + +export = uppercaseKeys; diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/docs/types/test.ts b/lib/node_modules/@stdlib/object/uppercase-keys/docs/types/test.ts new file mode 100644 index 000000000000..d6351ee1fa02 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/docs/types/test.ts @@ -0,0 +1,33 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2019 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import uppercaseKeys = require( './index' ); + + +// TESTS // + +// The function returns an object... +{ + uppercaseKeys( { 'beep': 1, 'boop': 2 } ); // $ExpectType Object +} + +// The compiler throws an error if the function is provided an incorrect number of arguments... +{ + uppercaseKeys(); // $ExpectError + uppercaseKeys( [], 2 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/examples/index.js b/lib/node_modules/@stdlib/object/uppercase-keys/examples/index.js new file mode 100644 index 000000000000..921bd575e5de --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/examples/index.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var uppercaseKeys = require( './../lib' ); + +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' } diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/lib/index.js b/lib/node_modules/@stdlib/object/uppercase-keys/lib/index.js new file mode 100644 index 000000000000..56b15bbfbec7 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/lib/index.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Convert each object key to uppercase. +* +* @module @stdlib/object/uppercase-keys +* +* @example +* var uppercaseKeys = require( '@stdlib/object/uppercase-keys' ); +* +* var obj1 = { +* 'a': 1, +* 'b': 2 +* }; +* +* var obj2 = uppercaseKeys( obj1 ); +* // returns { 'A': 1, 'B': 2 } +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/lib/main.js b/lib/node_modules/@stdlib/object/uppercase-keys/lib/main.js new file mode 100644 index 000000000000..7c9db4092914 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/lib/main.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var format = require( '@stdlib/string/format' ); + + +// MAIN // + +/** +* Converts each object key to uppercase. +* +* @param {Object} obj - source object +* @throws {TypeError} must provide an object +* @returns {Object} new object +* +* @example +* var obj1 = { +* 'a': 1, +* 'b': 2 +* }; +* +* var obj2 = uppercaseKeys( obj1 ); +* // returns { 'A': 1, 'B': 2 } +*/ +function uppercaseKeys( obj ) { + var out; + var key; + if ( typeof obj !== 'object' || obj === null ) { + throw new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', obj ) ); + } + out = {}; + for ( key in obj ) { + if ( hasOwnProp( obj, key ) ) { + out[ key.toUpperCase() ] = obj[ key ]; + } + } + return out; +} + + +// EXPORTS // + +module.exports = uppercaseKeys; diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/package.json b/lib/node_modules/@stdlib/object/uppercase-keys/package.json new file mode 100644 index 000000000000..2f43f3bc2630 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/object/uppercase-keys", + "version": "0.0.0", + "description": "Convert each object key to uppercase.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdutils", + "stdutil", + "utilities", + "utility", + "utils", + "util", + "map", + "transform", + "uppercase", + "copy", + "cp", + "clone", + "extract", + "property", + "props", + "properties", + "keys", + "object", + "array", + "obj" + ] +} diff --git a/lib/node_modules/@stdlib/object/uppercase-keys/test/test.js b/lib/node_modules/@stdlib/object/uppercase-keys/test/test.js new file mode 100644 index 000000000000..d0c1d8fa6920 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uppercase-keys/test/test.js @@ -0,0 +1,191 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var uppercaseKeys = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof uppercaseKeys, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function throws an error if provided a source object argument which is not an object', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + true + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + uppercaseKeys( value ); + }; + } +}); + +tape( 'the function uppercases keys from a source object, mapping the transformed keys to a destination object having the same key values', function test( t ) { + var expected; + var obj1; + var obj2; + + obj1 = { + '': 3.14, + 'Beep': 0, + 'a': 1, + 'b': 2, + 'c': 3, + 'd': 4, + 'e': 5 + }; + + obj2 = uppercaseKeys( obj1 ); + + expected = { + '': 3.14, + 'BEEP': 0, + 'A': 1, + 'B': 2, + 'C': 3, + 'D': 4, + 'E': 5 + }; + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.end(); +}); + +tape( 'the function ignores inherited properties', function test( t ) { + var expected; + var obj1; + var obj2; + + function Foo() { + this.a = 1; + this.b = 2; + this.c = 3; + this.d = 4; + this.e = 5; + return this; + } + + Foo.prototype.f = 6; + Foo.prototype.g = 7; + + obj1 = new Foo(); + + obj2 = uppercaseKeys( obj1 ); + + expected = { + 'A': 1, + 'B': 2, + 'C': 3, + 'D': 4, + 'E': 5 + }; + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.end(); +}); + +tape( 'the function accepts non-plain objects', function test( t ) { + var expected; + var obj1; + var obj2; + + obj1 = [ 0, 1, 2, 3, 4, 5 ]; + + obj2 = uppercaseKeys( obj1 ); + + expected = { + '0': 0, + '1': 1, + '2': 2, + '3': 3, + '4': 4, + '5': 5 + }; + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.end(); +}); + +tape( 'the function shallow copies key values', function test( t ) { + var expected; + var obj1; + var obj2; + + obj1 = { + 'a': [ 1 ], + 'b': [ 2 ], + 'c': [ 3 ], + 'd': [ 4 ], + 'e': [ 5 ] + }; + + obj2 = uppercaseKeys( obj1 ); + + expected = { + 'A': obj1.a, + 'B': obj1.b, + 'C': obj1.c, + 'D': obj1.d, + 'E': obj1.e + }; + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.strictEqual( obj2.A, obj1.a, 'returns shallow copy' ); + t.strictEqual( obj2.B, obj1.b, 'returns shallow copy' ); + t.strictEqual( obj2.C, obj1.c, 'returns shallow copy' ); + t.strictEqual( obj2.D, obj1.d, 'returns shallow copy' ); + t.strictEqual( obj2.E, obj1.e, 'returns shallow copy' ); + + t.end(); +}); + +tape( 'if provided an empty object, the function returns an empty object', function test( t ) { + var expected; + var obj1; + var obj2; + + obj1 = {}; + expected = {}; + + obj2 = uppercaseKeys( obj1 ); + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.end(); +}); From 49f6e4048516c9a4a13bcf8856fd3bf384b0d241 Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Wed, 24 Dec 2025 19:56:49 +0530 Subject: [PATCH 2/4] remove: remove `uppercaseKeys` from namespace This commit removes the `uppercaseKeys` symbol from the `@stdlib/utils` namespace due to a package migration. BREAKING CHANGE: remove `uppercaseKeys` To migrate, users should access the same symbol via the `@stdlib/object` namespace. Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/utils/docs/types/index.d.ts | 23 ------------------- lib/node_modules/@stdlib/utils/lib/index.js | 9 -------- 2 files changed, 32 deletions(-) diff --git a/lib/node_modules/@stdlib/utils/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/docs/types/index.d.ts index 5a380756fb2f..02399aba639d 100644 --- a/lib/node_modules/@stdlib/utils/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/utils/docs/types/index.d.ts @@ -215,7 +215,6 @@ import until = require( '@stdlib/utils/until' ); import untilEach = require( '@stdlib/utils/until-each' ); import untilEachRight = require( '@stdlib/utils/until-each-right' ); import unzip = require( '@stdlib/utils/unzip' ); -import uppercaseKeys = require( '@stdlib/utils/uppercase-keys' ); import objectValues = require( '@stdlib/utils/values' ); import objectValuesIn = require( '@stdlib/utils/values-in' ); import whilst = require( '@stdlib/utils/while' ); @@ -5763,28 +5762,6 @@ interface Namespace { */ unzip: typeof unzip; - /** - * Converts each object key to uppercase. - * - * ## Notes - * - * - The function only transforms own properties. Hence, the function does not transform inherited properties. - * - The function shallow copies key values. - * - * @param obj - source object - * @returns new object - * - * @example - * var obj1 = { - * 'a': 1, - * 'b': 2 - * }; - * - * var obj2 = ns.uppercaseKeys( obj1 ); - * // returns { 'A': 1, 'B': 2 } - */ - uppercaseKeys: typeof uppercaseKeys; - /** * Returns an array of an object's own enumerable property values. * diff --git a/lib/node_modules/@stdlib/utils/lib/index.js b/lib/node_modules/@stdlib/utils/lib/index.js index bebce94c9d04..16453ee01177 100644 --- a/lib/node_modules/@stdlib/utils/lib/index.js +++ b/lib/node_modules/@stdlib/utils/lib/index.js @@ -1795,15 +1795,6 @@ setReadOnly( utils, 'untilEachRight', require( '@stdlib/utils/until-each-right' */ setReadOnly( utils, 'unzip', require( '@stdlib/utils/unzip' ) ); -/** -* @name uppercaseKeys -* @memberof utils -* @readonly -* @type {Function} -* @see {@link module:@stdlib/utils/uppercase-keys} -*/ -setReadOnly( utils, 'uppercaseKeys', require( '@stdlib/utils/uppercase-keys' ) ); - /** * @name objectValues * @memberof utils From 0f5c679cf823f5163c177244a961d383faeea532 Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Wed, 24 Dec 2025 20:01:58 +0530 Subject: [PATCH 3/4] refactor: update paths Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv | 2 +- lib/node_modules/@stdlib/namespace/lib/namespace/c.js | 2 +- lib/node_modules/@stdlib/namespace/lib/namespace/l.js | 2 +- lib/node_modules/@stdlib/namespace/lib/namespace/u.js | 4 ++-- lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv | 2 +- .../@stdlib/namespace/pkg2related/data/data.csv | 6 +++--- .../@stdlib/namespace/pkg2standalone/data/data.csv | 2 +- .../@stdlib/namespace/standalone2pkg/data/data.csv | 2 +- lib/node_modules/@stdlib/object/capitalize-keys/README.md | 4 ++-- lib/node_modules/@stdlib/object/lowercase-keys/README.md | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv b/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv index 34406e9eb61f..9c6750717857 100644 --- a/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv @@ -3127,7 +3127,7 @@ untilEach,"@stdlib/utils/until-each" untilEachRight,"@stdlib/utils/until-each-right" unzip,"@stdlib/utils/unzip" uppercase,"@stdlib/string/uppercase" -uppercaseKeys,"@stdlib/utils/uppercase-keys" +uppercaseKeys,"@stdlib/object/uppercase-keys" US_STATES_ABBR,"@stdlib/datasets/us-states-abbr" US_STATES_CAPITALS,"@stdlib/datasets/us-states-capitals" US_STATES_CAPITALS_NAMES,"@stdlib/datasets/us-states-capitals-names" diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/c.js b/lib/node_modules/@stdlib/namespace/lib/namespace/c.js index 536b297fdc7e..6558e8d2f956 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/c.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/c.js @@ -59,7 +59,7 @@ ns.push({ 'type': 'Function', 'related': [ '@stdlib/object/uncapitalize-keys', - '@stdlib/utils/uppercase-keys' + '@stdlib/object/uppercase-keys' ] }); diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/l.js b/lib/node_modules/@stdlib/namespace/lib/namespace/l.js index 74681331b694..b4d96973f75a 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/l.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/l.js @@ -206,7 +206,7 @@ ns.push({ 'type': 'Function', 'related': [ '@stdlib/object/uncapitalize-keys', - '@stdlib/utils/uppercase-keys' + '@stdlib/object/uppercase-keys' ] }); diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/u.js b/lib/node_modules/@stdlib/namespace/lib/namespace/u.js index 936378bc03a1..57a03727c00e 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/u.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/u.js @@ -435,8 +435,8 @@ ns.push({ ns.push({ 'alias': 'uppercaseKeys', - 'path': '@stdlib/utils/uppercase-keys', - 'value': require( '@stdlib/utils/uppercase-keys' ), + 'path': '@stdlib/object/uppercase-keys', + 'value': require( '@stdlib/object/uppercase-keys' ), 'type': 'Function', 'related': [ '@stdlib/object/capitalize-keys', diff --git a/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv index 08d7bb090fa5..4c86190cc0cc 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv @@ -3127,7 +3127,7 @@ "@stdlib/utils/until-each-right",untilEachRight "@stdlib/utils/unzip",unzip "@stdlib/string/uppercase",uppercase -"@stdlib/utils/uppercase-keys",uppercaseKeys +"@stdlib/object/uppercase-keys",uppercaseKeys "@stdlib/datasets/us-states-abbr",US_STATES_ABBR "@stdlib/datasets/us-states-capitals",US_STATES_CAPITALS "@stdlib/datasets/us-states-capitals-names",US_STATES_CAPITALS_NAMES diff --git a/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv index 0ab573caebeb..6436facaf50b 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv @@ -1511,7 +1511,7 @@ "@stdlib/os/byte-order","@stdlib/assert/is-big-endian,@stdlib/assert/is-little-endian" "@stdlib/string/camelcase","@stdlib/string/constantcase,@stdlib/string/kebabcase,@stdlib/string/pascalcase,@stdlib/string/snakecase" "@stdlib/string/capitalize","@stdlib/string/uncapitalize,@stdlib/string/uppercase" -"@stdlib/object/capitalize-keys","@stdlib/object/uncapitalize-keys,@stdlib/utils/uppercase-keys" +"@stdlib/object/capitalize-keys","@stdlib/object/uncapitalize-keys,@stdlib/object/uppercase-keys" "@stdlib/constants/float64/catalan","" "@stdlib/constants/float64/cbrt-eps","@stdlib/constants/float64/eps,@stdlib/constants/float64/sqrt-eps" "@stdlib/datasets/cdc-nchs-us-births-1969-1988","@stdlib/datasets/cdc-nchs-us-births-1994-2003,@stdlib/datasets/ssa-us-births-2000-2014" @@ -2521,7 +2521,7 @@ "@stdlib/constants/float64/log10-e","@stdlib/constants/float64/e,@stdlib/constants/float64/log2-e" "@stdlib/array/logspace","@stdlib/array/incrspace,@stdlib/array/linspace" "@stdlib/string/lowercase","@stdlib/string/uncapitalize,@stdlib/string/uppercase" -"@stdlib/object/lowercase-keys","@stdlib/object/uncapitalize-keys,@stdlib/utils/uppercase-keys" +"@stdlib/object/lowercase-keys","@stdlib/object/uncapitalize-keys,@stdlib/object/uppercase-keys" "@stdlib/stats/lowess","" "@stdlib/string/left-pad","@stdlib/string/pad,@stdlib/string/right-pad" "@stdlib/string/left-trim","@stdlib/string/trim,@stdlib/string/right-trim" @@ -3127,7 +3127,7 @@ "@stdlib/utils/until-each-right","@stdlib/utils/until-each,@stdlib/utils/while-each-right" "@stdlib/utils/unzip","@stdlib/utils/zip" "@stdlib/string/uppercase","@stdlib/string/capitalize,@stdlib/string/lowercase" -"@stdlib/utils/uppercase-keys","@stdlib/object/capitalize-keys,@stdlib/object/lowercase-keys" +"@stdlib/object/uppercase-keys","@stdlib/object/capitalize-keys,@stdlib/object/lowercase-keys" "@stdlib/datasets/us-states-abbr","@stdlib/datasets/us-states-capitals,@stdlib/datasets/us-states-names" "@stdlib/datasets/us-states-capitals","@stdlib/datasets/us-states-abbr,@stdlib/datasets/us-states-capitals-names,@stdlib/datasets/us-states-names,@stdlib/datasets/us-states-names-capitals" "@stdlib/datasets/us-states-capitals-names","@stdlib/datasets/us-states-capitals,@stdlib/datasets/us-states-names,@stdlib/datasets/us-states-names-capitals" diff --git a/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv index a0d719aa0a90..6a9f749225b0 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv @@ -3127,7 +3127,7 @@ "@stdlib/utils/until-each-right","@stdlib/utils-until-each-right" "@stdlib/utils/unzip","@stdlib/utils-unzip" "@stdlib/string/uppercase","@stdlib/string-uppercase" -"@stdlib/utils/uppercase-keys","@stdlib/utils-uppercase-keys" +"@stdlib/object/uppercase-keys","@stdlib/object-uppercase-keys" "@stdlib/datasets/us-states-abbr","@stdlib/datasets-us-states-abbr" "@stdlib/datasets/us-states-capitals","@stdlib/datasets-us-states-capitals" "@stdlib/datasets/us-states-capitals-names","@stdlib/datasets-us-states-capitals-names" diff --git a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv index c4ddc7ecd2ca..7c6a4ccc6bae 100644 --- a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv @@ -3127,7 +3127,7 @@ "@stdlib/utils-until-each-right","@stdlib/utils/until-each-right" "@stdlib/utils-unzip","@stdlib/utils/unzip" "@stdlib/string-uppercase","@stdlib/string/uppercase" -"@stdlib/utils-uppercase-keys","@stdlib/utils/uppercase-keys" +"@stdlib/object-uppercase-keys","@stdlib/object/uppercase-keys" "@stdlib/datasets-us-states-abbr","@stdlib/datasets/us-states-abbr" "@stdlib/datasets-us-states-capitals","@stdlib/datasets/us-states-capitals" "@stdlib/datasets-us-states-capitals-names","@stdlib/datasets/us-states-capitals-names" diff --git a/lib/node_modules/@stdlib/object/capitalize-keys/README.md b/lib/node_modules/@stdlib/object/capitalize-keys/README.md index 1df7740eacf9..42649df0fc13 100644 --- a/lib/node_modules/@stdlib/object/capitalize-keys/README.md +++ b/lib/node_modules/@stdlib/object/capitalize-keys/README.md @@ -116,7 +116,7 @@ console.dir( obj2 ); ## See Also - [`@stdlib/object/uncapitalize-keys`][@stdlib/object/uncapitalize-keys]: convert the first letter of each object key to lowercase. -- [`@stdlib/utils/uppercase-keys`][@stdlib/utils/uppercase-keys]: convert each object key to uppercase. +- [`@stdlib/object/uppercase-keys`][@stdlib/object/uppercase-keys]: convert each object key to uppercase. @@ -130,7 +130,7 @@ console.dir( obj2 ); [@stdlib/object/uncapitalize-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/uncapitalize-keys -[@stdlib/utils/uppercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/uppercase-keys +[@stdlib/object/uppercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/uppercase-keys diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/README.md b/lib/node_modules/@stdlib/object/lowercase-keys/README.md index 4653ae4edf56..fef3d52ce4f8 100644 --- a/lib/node_modules/@stdlib/object/lowercase-keys/README.md +++ b/lib/node_modules/@stdlib/object/lowercase-keys/README.md @@ -116,7 +116,7 @@ console.dir( obj2 ); ## See Also - [`@stdlib/object/uncapitalize-keys`][@stdlib/object/uncapitalize-keys]: convert the first letter of each object key to lowercase. -- [`@stdlib/utils/uppercase-keys`][@stdlib/utils/uppercase-keys]: convert each object key to uppercase. +- [`@stdlib/object/uppercase-keys`][@stdlib/object/uppercase-keys]: convert each object key to uppercase. @@ -130,7 +130,7 @@ console.dir( obj2 ); [@stdlib/object/uncapitalize-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/uncapitalize-keys -[@stdlib/utils/uppercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/uppercase-keys +[@stdlib/object/uppercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/uppercase-keys From eab6ceb8bc74d9587d26843c42c999de30d82487 Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Wed, 24 Dec 2025 20:02:54 +0530 Subject: [PATCH 4/4] remove: remove `utils/uppercase-keys` This commit removes `@stdlib/utils/uppercase-keys` in favor of `@stdlib/object/uppercase-keys`. BREAKING CHANGE: remove `utils/uppercase-keys` To migrate, users should update their require/import paths to use `@stdlib/object/uppercase-keys` which provides the same API and implementation. Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/utils/uppercase-keys/README.md | 139 ------------- .../uppercase-keys/benchmark/benchmark.js | 57 ------ .../utils/uppercase-keys/docs/repl.txt | 28 --- .../uppercase-keys/docs/types/index.d.ts | 46 ----- .../utils/uppercase-keys/docs/types/test.ts | 33 --- .../utils/uppercase-keys/examples/index.js | 33 --- .../@stdlib/utils/uppercase-keys/lib/index.js | 45 ----- .../@stdlib/utils/uppercase-keys/lib/main.js | 63 ------ .../@stdlib/utils/uppercase-keys/package.json | 74 ------- .../@stdlib/utils/uppercase-keys/test/test.js | 191 ------------------ 10 files changed, 709 deletions(-) delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/README.md delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/examples/index.js delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/lib/index.js delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/lib/main.js delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/package.json delete mode 100644 lib/node_modules/@stdlib/utils/uppercase-keys/test/test.js diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/README.md b/lib/node_modules/@stdlib/utils/uppercase-keys/README.md deleted file mode 100644 index ee617c855af1..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/README.md +++ /dev/null @@ -1,139 +0,0 @@ - - -# uppercaseKeys - -> Convert each object key to uppercase. - - - -
- -
- - - - - -
- -## Usage - -```javascript -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. - -```javascript -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 - - - -```javascript -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' } -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/benchmark/benchmark.js b/lib/node_modules/@stdlib/utils/uppercase-keys/benchmark/benchmark.js deleted file mode 100644 index 7883aefc334d..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/benchmark/benchmark.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pkg = require( './../package.json' ).name; -var uppercaseKeys = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var obj; - var out; - var i; - - obj = { - 'a': 'beep', - 'b': 'boop', - 'c': 'foo', - 'd': 'bar', - 'e': randu() - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - obj.e = randu(); - out = uppercaseKeys( obj ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/docs/repl.txt b/lib/node_modules/@stdlib/utils/uppercase-keys/docs/repl.txt deleted file mode 100644 index d2f8f8cd68bd..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( obj ) - Converts each object key to uppercase. - - The function only transforms own properties. Hence, the function does not - transform inherited properties. - - The function shallow copies key values. - - Parameters - ---------- - obj: Object - Source object. - - Returns - ------- - out: Object - New object. - - Examples - -------- - > var obj = { 'a': 1, 'b': 2 }; - > var out = {{alias}}( obj ) - { 'A': 1, 'B': 2 } - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/index.d.ts deleted file mode 100644 index 5725878a5238..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/index.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts each object key to uppercase. -* -* ## Notes -* -* - The function only transforms own properties. Hence, the function does not transform inherited properties. -* - The function shallow copies key values. -* -* @param obj - source object -* @returns new object -* -* @example -* var obj1 = { -* 'a': 1, -* 'b': 2 -* }; -* -* var obj2 = uppercaseKeys( obj1 ); -* // returns { 'A': 1, 'B': 2 } -*/ -declare function uppercaseKeys( obj: Object ): Object; - - -// EXPORTS // - -export = uppercaseKeys; diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/test.ts b/lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/test.ts deleted file mode 100644 index d6351ee1fa02..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/docs/types/test.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import uppercaseKeys = require( './index' ); - - -// TESTS // - -// The function returns an object... -{ - uppercaseKeys( { 'beep': 1, 'boop': 2 } ); // $ExpectType Object -} - -// The compiler throws an error if the function is provided an incorrect number of arguments... -{ - uppercaseKeys(); // $ExpectError - uppercaseKeys( [], 2 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/examples/index.js b/lib/node_modules/@stdlib/utils/uppercase-keys/examples/index.js deleted file mode 100644 index 921bd575e5de..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var uppercaseKeys = require( './../lib' ); - -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' } diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/lib/index.js b/lib/node_modules/@stdlib/utils/uppercase-keys/lib/index.js deleted file mode 100644 index 3906d6f513bf..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert each object key to uppercase. -* -* @module @stdlib/utils/uppercase-keys -* -* @example -* var uppercaseKeys = require( '@stdlib/utils/uppercase-keys' ); -* -* var obj1 = { -* 'a': 1, -* 'b': 2 -* }; -* -* var obj2 = uppercaseKeys( obj1 ); -* // returns { 'A': 1, 'B': 2 } -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/lib/main.js b/lib/node_modules/@stdlib/utils/uppercase-keys/lib/main.js deleted file mode 100644 index 7c9db4092914..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Converts each object key to uppercase. -* -* @param {Object} obj - source object -* @throws {TypeError} must provide an object -* @returns {Object} new object -* -* @example -* var obj1 = { -* 'a': 1, -* 'b': 2 -* }; -* -* var obj2 = uppercaseKeys( obj1 ); -* // returns { 'A': 1, 'B': 2 } -*/ -function uppercaseKeys( obj ) { - var out; - var key; - if ( typeof obj !== 'object' || obj === null ) { - throw new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', obj ) ); - } - out = {}; - for ( key in obj ) { - if ( hasOwnProp( obj, key ) ) { - out[ key.toUpperCase() ] = obj[ key ]; - } - } - return out; -} - - -// EXPORTS // - -module.exports = uppercaseKeys; diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/package.json b/lib/node_modules/@stdlib/utils/uppercase-keys/package.json deleted file mode 100644 index 6a4450525d2c..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@stdlib/utils/uppercase-keys", - "version": "0.0.0", - "description": "Convert each object key to uppercase.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdutils", - "stdutil", - "utilities", - "utility", - "utils", - "util", - "map", - "transform", - "uppercase", - "copy", - "cp", - "clone", - "extract", - "property", - "props", - "properties", - "keys", - "object", - "array", - "obj" - ] -} diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/test/test.js b/lib/node_modules/@stdlib/utils/uppercase-keys/test/test.js deleted file mode 100644 index d0c1d8fa6920..000000000000 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/test/test.js +++ /dev/null @@ -1,191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var uppercaseKeys = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof uppercaseKeys, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided a source object argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - uppercaseKeys( value ); - }; - } -}); - -tape( 'the function uppercases keys from a source object, mapping the transformed keys to a destination object having the same key values', function test( t ) { - var expected; - var obj1; - var obj2; - - obj1 = { - '': 3.14, - 'Beep': 0, - 'a': 1, - 'b': 2, - 'c': 3, - 'd': 4, - 'e': 5 - }; - - obj2 = uppercaseKeys( obj1 ); - - expected = { - '': 3.14, - 'BEEP': 0, - 'A': 1, - 'B': 2, - 'C': 3, - 'D': 4, - 'E': 5 - }; - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.end(); -}); - -tape( 'the function ignores inherited properties', function test( t ) { - var expected; - var obj1; - var obj2; - - function Foo() { - this.a = 1; - this.b = 2; - this.c = 3; - this.d = 4; - this.e = 5; - return this; - } - - Foo.prototype.f = 6; - Foo.prototype.g = 7; - - obj1 = new Foo(); - - obj2 = uppercaseKeys( obj1 ); - - expected = { - 'A': 1, - 'B': 2, - 'C': 3, - 'D': 4, - 'E': 5 - }; - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.end(); -}); - -tape( 'the function accepts non-plain objects', function test( t ) { - var expected; - var obj1; - var obj2; - - obj1 = [ 0, 1, 2, 3, 4, 5 ]; - - obj2 = uppercaseKeys( obj1 ); - - expected = { - '0': 0, - '1': 1, - '2': 2, - '3': 3, - '4': 4, - '5': 5 - }; - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.end(); -}); - -tape( 'the function shallow copies key values', function test( t ) { - var expected; - var obj1; - var obj2; - - obj1 = { - 'a': [ 1 ], - 'b': [ 2 ], - 'c': [ 3 ], - 'd': [ 4 ], - 'e': [ 5 ] - }; - - obj2 = uppercaseKeys( obj1 ); - - expected = { - 'A': obj1.a, - 'B': obj1.b, - 'C': obj1.c, - 'D': obj1.d, - 'E': obj1.e - }; - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.strictEqual( obj2.A, obj1.a, 'returns shallow copy' ); - t.strictEqual( obj2.B, obj1.b, 'returns shallow copy' ); - t.strictEqual( obj2.C, obj1.c, 'returns shallow copy' ); - t.strictEqual( obj2.D, obj1.d, 'returns shallow copy' ); - t.strictEqual( obj2.E, obj1.e, 'returns shallow copy' ); - - t.end(); -}); - -tape( 'if provided an empty object, the function returns an empty object', function test( t ) { - var expected; - var obj1; - var obj2; - - obj1 = {}; - expected = {}; - - obj2 = uppercaseKeys( obj1 ); - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.end(); -});