From 94ba25d45d8e1ab32d53e3c55e40a276995b9dbb Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Mon, 22 Dec 2025 13:15:34 +0530 Subject: [PATCH 1/4] feat: add `object/lowercase-keys` Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/object/lowercase-keys/README.md | 139 +++++++++++++ .../lowercase-keys/benchmark/benchmark.js | 57 ++++++ .../object/lowercase-keys/docs/repl.txt | 28 +++ .../lowercase-keys/docs/types/index.d.ts | 46 +++++ .../object/lowercase-keys/docs/types/test.ts | 33 +++ .../object/lowercase-keys/examples/index.js | 33 +++ .../object/lowercase-keys/lib/index.js | 45 +++++ .../@stdlib/object/lowercase-keys/lib/main.js | 63 ++++++ .../object/lowercase-keys/package.json | 74 +++++++ .../object/lowercase-keys/test/test.js | 191 ++++++++++++++++++ 10 files changed, 709 insertions(+) create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/README.md create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/examples/index.js create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/lib/index.js create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/lib/main.js create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/package.json create mode 100644 lib/node_modules/@stdlib/object/lowercase-keys/test/test.js diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/README.md b/lib/node_modules/@stdlib/object/lowercase-keys/README.md new file mode 100644 index 000000000000..4653ae4edf56 --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-keys/README.md @@ -0,0 +1,139 @@ + + +# lowercaseKeys + +> Convert each object key to lowercase. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var lowercaseKeys = require( '@stdlib/object/lowercase-keys' ); +``` + +#### lowercaseKeys( obj ) + +Converts each `object` key to lowercase, mapping the transformed keys to a new `object` having the same values. + +```javascript +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 + + + +```javascript +var lowercaseKeys = require( '@stdlib/object/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' } +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/benchmark/benchmark.js b/lib/node_modules/@stdlib/object/lowercase-keys/benchmark/benchmark.js new file mode 100644 index 000000000000..270a9d2364f4 --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-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 lowercaseKeys = 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 = lowercaseKeys( 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/lowercase-keys/docs/repl.txt b/lib/node_modules/@stdlib/object/lowercase-keys/docs/repl.txt new file mode 100644 index 000000000000..8faefd592f45 --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-keys/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( obj ) + Converts each object key to lowercase. + + 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/lowercase-keys/docs/types/index.d.ts b/lib/node_modules/@stdlib/object/lowercase-keys/docs/types/index.d.ts new file mode 100644 index 000000000000..7eba790e877a --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-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 lowercase. +* +* ## 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 = lowercaseKeys( obj1 ); +* // returns { 'a': 1, 'b': 2 } +*/ +declare function lowercaseKeys( obj: Object ): Object; + + +// EXPORTS // + +export = lowercaseKeys; diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/docs/types/test.ts b/lib/node_modules/@stdlib/object/lowercase-keys/docs/types/test.ts new file mode 100644 index 000000000000..c8513b6aafe4 --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-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 lowercaseKeys = require( './index' ); + + +// TESTS // + +// The function returns an object... +{ + lowercaseKeys( { 'beep': 1, 'boop': 2 } ); // $ExpectType Object +} + +// The compiler throws an error if the function is provided an incorrect number of arguments... +{ + lowercaseKeys(); // $ExpectError + lowercaseKeys( [], 2 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/examples/index.js b/lib/node_modules/@stdlib/object/lowercase-keys/examples/index.js new file mode 100644 index 000000000000..92e0a4ccab1a --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-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 lowercaseKeys = require( './../lib' ); + +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' } diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/lib/index.js b/lib/node_modules/@stdlib/object/lowercase-keys/lib/index.js new file mode 100644 index 000000000000..234cffbf2ef6 --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-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 lowercase. +* +* @module @stdlib/object/lowercase-keys +* +* @example +* var lowercaseKeys = require( '@stdlib/object/lowercase-keys' ); +* +* var obj1 = { +* 'A': 1, +* 'B': 2 +* }; +* +* var obj2 = lowercaseKeys( obj1 ); +* // returns { 'a': 1, 'b': 2 } +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/lib/main.js b/lib/node_modules/@stdlib/object/lowercase-keys/lib/main.js new file mode 100644 index 000000000000..8725a1b3a868 --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-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 lowercase. +* +* @param {Object} obj - source object +* @throws {TypeError} must provide an object +* @returns {Object} new object +* +* @example +* var obj1 = { +* 'A': 1, +* 'B': 2 +* }; +* +* var obj2 = lowercaseKeys( obj1 ); +* // returns { 'a': 1, 'b': 2 } +*/ +function lowercaseKeys( 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.toLowerCase() ] = obj[ key ]; + } + } + return out; +} + + +// EXPORTS // + +module.exports = lowercaseKeys; diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/package.json b/lib/node_modules/@stdlib/object/lowercase-keys/package.json new file mode 100644 index 000000000000..b0dfe25798ba --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-keys/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/object/lowercase-keys", + "version": "0.0.0", + "description": "Convert each object key to lowercase.", + "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", + "lowercase", + "copy", + "cp", + "clone", + "extract", + "property", + "props", + "properties", + "keys", + "object", + "array", + "obj" + ] +} diff --git a/lib/node_modules/@stdlib/object/lowercase-keys/test/test.js b/lib/node_modules/@stdlib/object/lowercase-keys/test/test.js new file mode 100644 index 000000000000..9d88436e6d1c --- /dev/null +++ b/lib/node_modules/@stdlib/object/lowercase-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 lowercaseKeys = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof lowercaseKeys, '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() { + lowercaseKeys( value ); + }; + } +}); + +tape( 'the function lowercases 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 = lowercaseKeys( 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 = lowercaseKeys( 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 = lowercaseKeys( 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 = lowercaseKeys( 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 = lowercaseKeys( obj1 ); + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.end(); +}); From a3ecca1055cd20fea32cabad3dae3a0dc2d4671d Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Mon, 22 Dec 2025 13:16:59 +0530 Subject: [PATCH 2/4] remove: remove `lowercaseKeys` from namespace This commit removes the `lowercaseKeys` symbol from the `@stdlib/utils` namespace due to a package migration. BREAKING CHANGE: remove `lowercaseKeys` 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 bc2734371c6f..5a380756fb2f 100644 --- a/lib/node_modules/@stdlib/utils/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/utils/docs/types/index.d.ts @@ -124,7 +124,6 @@ import keyBy = require( '@stdlib/utils/key-by' ); import keyByRight = require( '@stdlib/utils/key-by-right' ); import objectKeys = require( '@stdlib/utils/keys' ); import keysIn = require( '@stdlib/utils/keys-in' ); -import lowercaseKeys = require( '@stdlib/utils/lowercase-keys' ); import map = require( '@stdlib/utils/map' ); import mapArguments = require( '@stdlib/utils/map-arguments' ); import mapFun = require( '@stdlib/utils/map-function' ); @@ -3122,28 +3121,6 @@ interface Namespace { */ keysIn: typeof keysIn; - /** - * Converts each object key to lowercase. - * - * ## 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.lowercaseKeys( obj1 ); - * // returns { 'a': 1, 'b': 2 } - */ - lowercaseKeys: typeof lowercaseKeys; - /** * Applies a function to each element in an array and assigns the result to an element in a new array. * diff --git a/lib/node_modules/@stdlib/utils/lib/index.js b/lib/node_modules/@stdlib/utils/lib/index.js index 85a717a6777f..bebce94c9d04 100644 --- a/lib/node_modules/@stdlib/utils/lib/index.js +++ b/lib/node_modules/@stdlib/utils/lib/index.js @@ -976,15 +976,6 @@ setReadOnly( utils, 'objectKeys', require( '@stdlib/utils/keys' ) ); */ setReadOnly( utils, 'keysIn', require( '@stdlib/utils/keys-in' ) ); -/** -* @name lowercaseKeys -* @memberof utils -* @readonly -* @type {Function} -* @see {@link module:@stdlib/utils/lowercase-keys} -*/ -setReadOnly( utils, 'lowercaseKeys', require( '@stdlib/utils/lowercase-keys' ) ); - /** * @name map * @memberof utils From c3a6f70afdf0149773b502c99f4a04538976d955 Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Mon, 22 Dec 2025 13:21:09 +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/l.js | 4 ++-- 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/uncapitalize-keys/README.md | 4 ++-- lib/node_modules/@stdlib/utils/uppercase-keys/README.md | 4 ++-- 9 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 f0bf8e2b4169..34406e9eb61f 100644 --- a/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv @@ -2521,7 +2521,7 @@ LOG2E,"@stdlib/constants/float64/log2-e" LOG10E,"@stdlib/constants/float64/log10-e" logspace,"@stdlib/array/logspace" lowercase,"@stdlib/string/lowercase" -lowercaseKeys,"@stdlib/utils/lowercase-keys" +lowercaseKeys,"@stdlib/object/lowercase-keys" lowess,"@stdlib/stats/lowess" lpad,"@stdlib/string/left-pad" ltrim,"@stdlib/string/left-trim" diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/l.js b/lib/node_modules/@stdlib/namespace/lib/namespace/l.js index 2de3cd81db43..74681331b694 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/l.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/l.js @@ -201,8 +201,8 @@ ns.push({ ns.push({ 'alias': 'lowercaseKeys', - 'path': '@stdlib/utils/lowercase-keys', - 'value': require( '@stdlib/utils/lowercase-keys' ), + 'path': '@stdlib/object/lowercase-keys', + 'value': require( '@stdlib/object/lowercase-keys' ), 'type': 'Function', 'related': [ '@stdlib/object/uncapitalize-keys', diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/u.js b/lib/node_modules/@stdlib/namespace/lib/namespace/u.js index 8c6da157358b..936378bc03a1 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/u.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/u.js @@ -194,7 +194,7 @@ ns.push({ 'type': 'Function', 'related': [ '@stdlib/object/capitalize-keys', - '@stdlib/utils/lowercase-keys' + '@stdlib/object/lowercase-keys' ] }); @@ -440,7 +440,7 @@ ns.push({ 'type': 'Function', 'related': [ '@stdlib/object/capitalize-keys', - '@stdlib/utils/lowercase-keys' + '@stdlib/object/lowercase-keys' ] }); diff --git a/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv index da5609c6bbd8..08d7bb090fa5 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv @@ -2521,7 +2521,7 @@ "@stdlib/constants/float64/log10-e",LOG10E "@stdlib/array/logspace",logspace "@stdlib/string/lowercase",lowercase -"@stdlib/utils/lowercase-keys",lowercaseKeys +"@stdlib/object/lowercase-keys",lowercaseKeys "@stdlib/stats/lowess",lowess "@stdlib/string/left-pad",lpad "@stdlib/string/left-trim",ltrim diff --git a/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv index 9c64b0941945..0ab573caebeb 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv @@ -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/utils/lowercase-keys","@stdlib/object/uncapitalize-keys,@stdlib/utils/uppercase-keys" +"@stdlib/object/lowercase-keys","@stdlib/object/uncapitalize-keys,@stdlib/utils/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" @@ -3108,7 +3108,7 @@ "@stdlib/array/uint32","@stdlib/array/buffer,@stdlib/array/float32,@stdlib/array/float64,@stdlib/array/int16,@stdlib/array/int32,@stdlib/array/int8,@stdlib/array/uint16,@stdlib/array/uint8,@stdlib/array/uint8c" "@stdlib/process/umask","" "@stdlib/string/uncapitalize","@stdlib/string/capitalize,@stdlib/string/lowercase" -"@stdlib/object/uncapitalize-keys","@stdlib/object/capitalize-keys,@stdlib/utils/lowercase-keys" +"@stdlib/object/uncapitalize-keys","@stdlib/object/capitalize-keys,@stdlib/object/lowercase-keys" "@stdlib/utils/uncurry","@stdlib/utils/curry,@stdlib/utils/uncurry-right" "@stdlib/utils/uncurry-right","@stdlib/utils/curry,@stdlib/utils/curry-right,@stdlib/utils/uncurry" "@stdlib/constants/unicode/max","@stdlib/constants/unicode/max-bmp" @@ -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/utils/lowercase-keys" +"@stdlib/utils/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 17af207f89cf..a0d719aa0a90 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv @@ -2521,7 +2521,7 @@ "@stdlib/constants/float64/log10-e","@stdlib/constants-float64-log10-e" "@stdlib/array/logspace","@stdlib/array-logspace" "@stdlib/string/lowercase","@stdlib/string-lowercase" -"@stdlib/utils/lowercase-keys","@stdlib/utils-lowercase-keys" +"@stdlib/object/lowercase-keys","@stdlib/object-lowercase-keys" "@stdlib/stats/lowess","@stdlib/stats-lowess" "@stdlib/string/left-pad","@stdlib/string-left-pad" "@stdlib/string/left-trim","@stdlib/string-left-trim" diff --git a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv index ce3b71024f23..c4ddc7ecd2ca 100644 --- a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv @@ -2521,7 +2521,7 @@ "@stdlib/constants-float64-log10-e","@stdlib/constants/float64/log10-e" "@stdlib/array-logspace","@stdlib/array/logspace" "@stdlib/string-lowercase","@stdlib/string/lowercase" -"@stdlib/utils-lowercase-keys","@stdlib/utils/lowercase-keys" +"@stdlib/object-lowercase-keys","@stdlib/object/lowercase-keys" "@stdlib/stats-lowess","@stdlib/stats/lowess" "@stdlib/string-left-pad","@stdlib/string/left-pad" "@stdlib/string-left-trim","@stdlib/string/left-trim" diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/README.md b/lib/node_modules/@stdlib/object/uncapitalize-keys/README.md index bc8b68418c5c..de04e4a9e24e 100644 --- a/lib/node_modules/@stdlib/object/uncapitalize-keys/README.md +++ b/lib/node_modules/@stdlib/object/uncapitalize-keys/README.md @@ -116,7 +116,7 @@ console.dir( obj2 ); ## See Also - [`@stdlib/object/capitalize-keys`][@stdlib/object/capitalize-keys]: convert the first letter of each object key to uppercase. -- [`@stdlib/utils/lowercase-keys`][@stdlib/utils/lowercase-keys]: convert each object key to lowercase. +- [`@stdlib/object/lowercase-keys`][@stdlib/object/lowercase-keys]: convert each object key to lowercase. @@ -130,7 +130,7 @@ console.dir( obj2 ); [@stdlib/object/capitalize-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/capitalize-keys -[@stdlib/utils/lowercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/lowercase-keys +[@stdlib/object/lowercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/lowercase-keys diff --git a/lib/node_modules/@stdlib/utils/uppercase-keys/README.md b/lib/node_modules/@stdlib/utils/uppercase-keys/README.md index 62856b7235fa..ee617c855af1 100644 --- a/lib/node_modules/@stdlib/utils/uppercase-keys/README.md +++ b/lib/node_modules/@stdlib/utils/uppercase-keys/README.md @@ -116,7 +116,7 @@ console.dir( obj2 ); ## See Also - [`@stdlib/object/capitalize-keys`][@stdlib/object/capitalize-keys]: convert the first letter of each object key to uppercase. -- [`@stdlib/utils/lowercase-keys`][@stdlib/utils/lowercase-keys]: convert each object key to lowercase. +- [`@stdlib/object/lowercase-keys`][@stdlib/object/lowercase-keys]: convert each object key to lowercase. @@ -130,7 +130,7 @@ console.dir( obj2 ); [@stdlib/object/capitalize-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/capitalize-keys -[@stdlib/utils/lowercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/lowercase-keys +[@stdlib/object/lowercase-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/lowercase-keys From 9acae7a1056a920b2357cb2272bd357f7eb5e46f Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Mon, 22 Dec 2025 13:22:55 +0530 Subject: [PATCH 4/4] remove: remove `utils/lowercase-keys` This commit removes `@stdlib/utils/lowercase-keys` in favor of `@stdlib/object/lowercase-keys`. BREAKING CHANGE: remove `utils/lowercase-keys` To migrate, users should update their require/import paths to use `@stdlib/object/lowercase-keys` which provides the same API and implementation. Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/utils/lowercase-keys/README.md | 139 ------------- .../lowercase-keys/benchmark/benchmark.js | 57 ------ .../utils/lowercase-keys/docs/repl.txt | 28 --- .../lowercase-keys/docs/types/index.d.ts | 46 ----- .../utils/lowercase-keys/docs/types/test.ts | 33 --- .../utils/lowercase-keys/examples/index.js | 33 --- .../@stdlib/utils/lowercase-keys/lib/index.js | 45 ----- .../@stdlib/utils/lowercase-keys/lib/main.js | 63 ------ .../@stdlib/utils/lowercase-keys/package.json | 74 ------- .../@stdlib/utils/lowercase-keys/test/test.js | 191 ------------------ 10 files changed, 709 deletions(-) delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/README.md delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/examples/index.js delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/lib/index.js delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/lib/main.js delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/package.json delete mode 100644 lib/node_modules/@stdlib/utils/lowercase-keys/test/test.js diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/README.md b/lib/node_modules/@stdlib/utils/lowercase-keys/README.md deleted file mode 100644 index 700ff2e7d66e..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-keys/README.md +++ /dev/null @@ -1,139 +0,0 @@ - - -# lowercaseKeys - -> Convert each object key to lowercase. - - - -
- -
- - - - - -
- -## Usage - -```javascript -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. - -```javascript -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 - - - -```javascript -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' } -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/benchmark/benchmark.js b/lib/node_modules/@stdlib/utils/lowercase-keys/benchmark/benchmark.js deleted file mode 100644 index 270a9d2364f4..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-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 lowercaseKeys = 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 = lowercaseKeys( 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/lowercase-keys/docs/repl.txt b/lib/node_modules/@stdlib/utils/lowercase-keys/docs/repl.txt deleted file mode 100644 index 8faefd592f45..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-keys/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( obj ) - Converts each object key to lowercase. - - 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/lowercase-keys/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/lowercase-keys/docs/types/index.d.ts deleted file mode 100644 index 7eba790e877a..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-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 lowercase. -* -* ## 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 = lowercaseKeys( obj1 ); -* // returns { 'a': 1, 'b': 2 } -*/ -declare function lowercaseKeys( obj: Object ): Object; - - -// EXPORTS // - -export = lowercaseKeys; diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/docs/types/test.ts b/lib/node_modules/@stdlib/utils/lowercase-keys/docs/types/test.ts deleted file mode 100644 index c8513b6aafe4..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-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 lowercaseKeys = require( './index' ); - - -// TESTS // - -// The function returns an object... -{ - lowercaseKeys( { 'beep': 1, 'boop': 2 } ); // $ExpectType Object -} - -// The compiler throws an error if the function is provided an incorrect number of arguments... -{ - lowercaseKeys(); // $ExpectError - lowercaseKeys( [], 2 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/examples/index.js b/lib/node_modules/@stdlib/utils/lowercase-keys/examples/index.js deleted file mode 100644 index 92e0a4ccab1a..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-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 lowercaseKeys = require( './../lib' ); - -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' } diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/lib/index.js b/lib/node_modules/@stdlib/utils/lowercase-keys/lib/index.js deleted file mode 100644 index e7df1e4dd0fd..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-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 lowercase. -* -* @module @stdlib/utils/lowercase-keys -* -* @example -* var lowercaseKeys = require( '@stdlib/utils/lowercase-keys' ); -* -* var obj1 = { -* 'A': 1, -* 'B': 2 -* }; -* -* var obj2 = lowercaseKeys( obj1 ); -* // returns { 'a': 1, 'b': 2 } -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/lib/main.js b/lib/node_modules/@stdlib/utils/lowercase-keys/lib/main.js deleted file mode 100644 index 8725a1b3a868..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-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 lowercase. -* -* @param {Object} obj - source object -* @throws {TypeError} must provide an object -* @returns {Object} new object -* -* @example -* var obj1 = { -* 'A': 1, -* 'B': 2 -* }; -* -* var obj2 = lowercaseKeys( obj1 ); -* // returns { 'a': 1, 'b': 2 } -*/ -function lowercaseKeys( 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.toLowerCase() ] = obj[ key ]; - } - } - return out; -} - - -// EXPORTS // - -module.exports = lowercaseKeys; diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/package.json b/lib/node_modules/@stdlib/utils/lowercase-keys/package.json deleted file mode 100644 index 6d8efef6edbb..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-keys/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@stdlib/utils/lowercase-keys", - "version": "0.0.0", - "description": "Convert each object key to lowercase.", - "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", - "lowercase", - "copy", - "cp", - "clone", - "extract", - "property", - "props", - "properties", - "keys", - "object", - "array", - "obj" - ] -} diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/test/test.js b/lib/node_modules/@stdlib/utils/lowercase-keys/test/test.js deleted file mode 100644 index 9d88436e6d1c..000000000000 --- a/lib/node_modules/@stdlib/utils/lowercase-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 lowercaseKeys = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof lowercaseKeys, '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() { - lowercaseKeys( value ); - }; - } -}); - -tape( 'the function lowercases 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 = lowercaseKeys( 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 = lowercaseKeys( 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 = lowercaseKeys( 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 = lowercaseKeys( 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 = lowercaseKeys( obj1 ); - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.end(); -});