From 903d8c7f7dde866c82819a523f1648ea167d5172 Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Sun, 21 Dec 2025 11:51:36 +0530 Subject: [PATCH 1/4] feat: add `object/uncapitalize-keys` Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../object/uncapitalize-keys/README.md | 139 +++++++++++++ .../uncapitalize-keys/benchmark/benchmark.js | 57 ++++++ .../object/uncapitalize-keys/docs/repl.txt | 28 +++ .../uncapitalize-keys/docs/types/index.d.ts | 46 +++++ .../uncapitalize-keys/docs/types/test.ts | 33 +++ .../uncapitalize-keys/examples/index.js | 33 +++ .../object/uncapitalize-keys/lib/index.js | 45 ++++ .../object/uncapitalize-keys/lib/main.js | 69 +++++++ .../object/uncapitalize-keys/package.json | 76 +++++++ .../object/uncapitalize-keys/test/test.js | 193 ++++++++++++++++++ 10 files changed, 719 insertions(+) create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/README.md create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/examples/index.js create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/lib/index.js create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/lib/main.js create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/package.json create mode 100644 lib/node_modules/@stdlib/object/uncapitalize-keys/test/test.js diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/README.md b/lib/node_modules/@stdlib/object/uncapitalize-keys/README.md new file mode 100644 index 000000000000..bc8b68418c5c --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-keys/README.md @@ -0,0 +1,139 @@ + + +# uncapitalizeKeys + +> Convert the first letter of each object key to lowercase. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var uncapitalizeKeys = require( '@stdlib/object/uncapitalize-keys' ); +``` + +#### uncapitalizeKeys( obj ) + +Converts the first letter of each `object` key to lowercase, mapping the transformed keys to a new `object` having the same values. + +```javascript +var obj1 = { + 'BeepBoop': 1, + 'FooBar': 2 +}; + +var obj2 = uncapitalizeKeys( obj1 ); +// returns { 'beepBoop': 1, 'fooBar': 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 uncapitalizeKeys = require( '@stdlib/object/uncapitalize-keys' ); + +var obj1 = { + 'AA': 'beep', + 'BB': 'boop', + 'CC': 'foo', + 'DD': 'bar' +}; + +var obj2 = uncapitalizeKeys( obj1 ); + +console.dir( obj2 ); +// => { 'aA': 'beep', 'bB': 'boop', 'cC': 'foo', 'dD': 'bar' } +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/benchmark/benchmark.js b/lib/node_modules/@stdlib/object/uncapitalize-keys/benchmark/benchmark.js new file mode 100644 index 000000000000..21c81d9b6b2c --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-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 uncapitalizeKeys = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var obj; + var out; + var i; + + obj = { + 'AA': 'beep', + 'BB': 'boop', + 'CC': 'foo', + 'DD': 'bar', + 'EE': randu() + }; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + obj.EE = randu(); + out = uncapitalizeKeys( 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/uncapitalize-keys/docs/repl.txt b/lib/node_modules/@stdlib/object/uncapitalize-keys/docs/repl.txt new file mode 100644 index 000000000000..6a7206433fec --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-keys/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( obj ) + Converts the first letter of 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 = { 'AA': 1, 'BB': 2 }; + > var out = {{alias}}( obj ) + { 'aA': 1, 'bB': 2 } + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/docs/types/index.d.ts b/lib/node_modules/@stdlib/object/uncapitalize-keys/docs/types/index.d.ts new file mode 100644 index 000000000000..7cf075148558 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-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 the first letter of 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 = { +* 'AA': 1, +* 'BB': 2 +* }; +* +* var obj2 = uncapitalizeKeys( obj1 ); +* // returns { 'aA': 1, 'bB': 2 } +*/ +declare function uncapitalizeKeys( obj: Object ): Object; + + +// EXPORTS // + +export = uncapitalizeKeys; diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/docs/types/test.ts b/lib/node_modules/@stdlib/object/uncapitalize-keys/docs/types/test.ts new file mode 100644 index 000000000000..36ec97ebe648 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-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 uncapitalizeKeys = require( './index' ); + + +// TESTS // + +// The function returns an object... +{ + uncapitalizeKeys( { 'a': 1, 'b': 2 } ); // $ExpectType Object +} + +// The compiler throws an error if the function is provided an incorrect number of arguments... +{ + uncapitalizeKeys(); // $ExpectError + uncapitalizeKeys( [], 2 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/examples/index.js b/lib/node_modules/@stdlib/object/uncapitalize-keys/examples/index.js new file mode 100644 index 000000000000..69e6bd086d64 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-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 uncapitalizeKeys = require( './../lib' ); + +var obj1 = { + 'AA': 'beep', + 'BB': 'boop', + 'CC': 'foo', + 'DD': 'bar' +}; + +var obj2 = uncapitalizeKeys( obj1 ); + +console.dir( obj2 ); +// => { 'aA': 'beep', 'bB': 'boop', 'cC': 'foo', 'dD': 'bar' } diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/lib/index.js b/lib/node_modules/@stdlib/object/uncapitalize-keys/lib/index.js new file mode 100644 index 000000000000..bcffc7ac9b7a --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-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 the first letter of each object key to lowercase. +* +* @module @stdlib/object/uncapitalize-keys +* +* @example +* var uncapitalizeKeys = require( '@stdlib/object/uncapitalize-keys' ); +* +* var obj1 = { +* 'AA': 1, +* 'BB': 2 +* }; +* +* var obj2 = uncapitalizeKeys( obj1 ); +* // returns { 'aA': 1, 'bB': 2 } +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/lib/main.js b/lib/node_modules/@stdlib/object/uncapitalize-keys/lib/main.js new file mode 100644 index 000000000000..feb21d598eae --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-keys/lib/main.js @@ -0,0 +1,69 @@ +/** +* @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 the first letter of each object key to lowercase. +* +* @param {Object} obj - source object +* @throws {TypeError} must provide an object +* @returns {Object} new object +* +* @example +* var obj1 = { +* 'AA': 1, +* 'BB': 2 +* }; +* +* var obj2 = uncapitalizeKeys( obj1 ); +* // returns { 'aA': 1, 'bB': 2 } +*/ +function uncapitalizeKeys( obj ) { + var out; + var key; + var k; + 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 ) ) { + if ( key === '' ) { + out[ key ] = obj[ key ]; + } else { + k = key.charAt( 0 ).toLowerCase() + key.slice( 1 ); + out[ k ] = obj[ key ]; + } + } + } + return out; +} + + +// EXPORTS // + +module.exports = uncapitalizeKeys; diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/package.json b/lib/node_modules/@stdlib/object/uncapitalize-keys/package.json new file mode 100644 index 000000000000..e550b7bd7b23 --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-keys/package.json @@ -0,0 +1,76 @@ +{ + "name": "@stdlib/object/uncapitalize-keys", + "version": "0.0.0", + "description": "Convert the first letter of 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", + "uncapitalize", + "lowercase", + "first", + "copy", + "cp", + "clone", + "extract", + "property", + "props", + "properties", + "keys", + "object", + "array", + "obj" + ] +} diff --git a/lib/node_modules/@stdlib/object/uncapitalize-keys/test/test.js b/lib/node_modules/@stdlib/object/uncapitalize-keys/test/test.js new file mode 100644 index 000000000000..212f663cd18d --- /dev/null +++ b/lib/node_modules/@stdlib/object/uncapitalize-keys/test/test.js @@ -0,0 +1,193 @@ +/** +* @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 uncapitalizeKeys = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof uncapitalizeKeys, '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() { + uncapitalizeKeys( value ); + }; + } +}); + +tape( 'the function lowercases the first letter of each key 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 = { + '': 0, + 'beep': 3.14, + ' Boop': -1.0, + 'AA': 1, + 'BB': 2, + 'CC': 3, + 'DD': 4, + 'EE': 5 + }; + + obj2 = uncapitalizeKeys( obj1 ); + + expected = { + '': 0, + 'beep': 3.14, + ' Boop': -1.0, + 'aA': 1, + 'bB': 2, + 'cC': 3, + 'dD': 4, + 'eE': 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.AA = 1; + this.BB = 2; + this.CC = 3; + this.DD = 4; + this.EE = 5; + return this; + } + + Foo.prototype.FF = 6; + Foo.prototype.GG = 7; + + obj1 = new Foo(); + + obj2 = uncapitalizeKeys( obj1 ); + + expected = { + 'aA': 1, + 'bB': 2, + 'cC': 3, + 'dD': 4, + 'eE': 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 = uncapitalizeKeys( 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 = { + 'AA': [ 1 ], + 'BB': [ 2 ], + 'CC': [ 3 ], + 'DD': [ 4 ], + 'EE': [ 5 ] + }; + + obj2 = uncapitalizeKeys( obj1 ); + + expected = { + 'aA': obj1.AA, + 'bB': obj1.BB, + 'cC': obj1.CC, + 'dD': obj1.DD, + 'eE': obj1.EE + }; + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.strictEqual( obj2.aA, obj1.AA, 'returns shallow copy' ); + t.strictEqual( obj2.bB, obj1.BB, 'returns shallow copy' ); + t.strictEqual( obj2.cC, obj1.CC, 'returns shallow copy' ); + t.strictEqual( obj2.dD, obj1.DD, 'returns shallow copy' ); + t.strictEqual( obj2.eE, obj1.EE, '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 = uncapitalizeKeys( obj1 ); + + t.deepEqual( obj2, expected, 'returns expected object' ); + t.end(); +}); From be1ca2574e74451ba5e410b61a71cfb23af478ae Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Sun, 21 Dec 2025 11:53:55 +0530 Subject: [PATCH 2/4] remove: remove `uncapitalizeKeys` from namespace This commit removes the `uncapitalizeKeys` symbol from the `@stdlib/utils` namespace due to a package migration. BREAKING CHANGE: remove `uncapitalizeKeys` 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 45c0a22fd824..bc2734371c6f 100644 --- a/lib/node_modules/@stdlib/utils/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/utils/docs/types/index.d.ts @@ -209,7 +209,6 @@ import trythen = require( '@stdlib/utils/try-then' ); import typemax = require( '@stdlib/utils/type-max' ); import typemin = require( '@stdlib/utils/type-min' ); import typeOf = require( '@stdlib/utils/type-of' ); -import uncapitalizeKeys = require( '@stdlib/utils/uncapitalize-keys' ); import uncurry = require( '@stdlib/utils/uncurry' ); import uncurryRight = require( '@stdlib/utils/uncurry-right' ); import unshift = require( '@stdlib/utils/unshift' ); @@ -5602,28 +5601,6 @@ interface Namespace { */ typeOf: typeof typeOf; - /** - * Converts the first letter of 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 = { - * 'AA': 1, - * 'BB': 2 - * }; - * - * var obj2 = ns.uncapitalizeKeys( obj1 ); - * // returns { 'aA': 1, 'bB': 2 } - */ - uncapitalizeKeys: typeof uncapitalizeKeys; - /** * Transforms a curried function into a function invoked with multiple arguments. * diff --git a/lib/node_modules/@stdlib/utils/lib/index.js b/lib/node_modules/@stdlib/utils/lib/index.js index e5aa84484937..85a717a6777f 100644 --- a/lib/node_modules/@stdlib/utils/lib/index.js +++ b/lib/node_modules/@stdlib/utils/lib/index.js @@ -1741,15 +1741,6 @@ setReadOnly( utils, 'typemin', require( '@stdlib/utils/type-min' ) ); */ setReadOnly( utils, 'typeOf', require( '@stdlib/utils/type-of' ) ); -/** -* @name uncapitalizeKeys -* @memberof utils -* @readonly -* @type {Function} -* @see {@link module:@stdlib/utils/uncapitalize-keys} -*/ -setReadOnly( utils, 'uncapitalizeKeys', require( '@stdlib/utils/uncapitalize-keys' ) ); - /** * @name uncurry * @memberof utils From 9012bd745d6950f94f4c376b5b52520bc2017dd3 Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Sun, 21 Dec 2025 12:06:16 +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/utils/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 f96bcc9fd7c9..f0bf8e2b4169 100644 --- a/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv @@ -3108,7 +3108,7 @@ UINT32_NUM_BYTES,"@stdlib/constants/uint32/num-bytes" Uint32Array,"@stdlib/array/uint32" umask,"@stdlib/process/umask" uncapitalize,"@stdlib/string/uncapitalize" -uncapitalizeKeys,"@stdlib/utils/uncapitalize-keys" +uncapitalizeKeys,"@stdlib/object/uncapitalize-keys" uncurry,"@stdlib/utils/uncurry" uncurryRight,"@stdlib/utils/uncurry-right" UNICODE_MAX,"@stdlib/constants/unicode/max" diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/c.js b/lib/node_modules/@stdlib/namespace/lib/namespace/c.js index f8bbb3d2a45e..536b297fdc7e 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/c.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/c.js @@ -58,7 +58,7 @@ ns.push({ 'value': require( '@stdlib/object/capitalize-keys' ), 'type': 'Function', 'related': [ - '@stdlib/utils/uncapitalize-keys', + '@stdlib/object/uncapitalize-keys', '@stdlib/utils/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 a78cba277c33..2de3cd81db43 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/l.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/l.js @@ -205,7 +205,7 @@ ns.push({ 'value': require( '@stdlib/utils/lowercase-keys' ), 'type': 'Function', 'related': [ - '@stdlib/utils/uncapitalize-keys', + '@stdlib/object/uncapitalize-keys', '@stdlib/utils/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 a4cb3b2bbb15..8c6da157358b 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/u.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/u.js @@ -189,8 +189,8 @@ ns.push({ ns.push({ 'alias': 'uncapitalizeKeys', - 'path': '@stdlib/utils/uncapitalize-keys', - 'value': require( '@stdlib/utils/uncapitalize-keys' ), + 'path': '@stdlib/object/uncapitalize-keys', + 'value': require( '@stdlib/object/uncapitalize-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 0f3be9d75584..da5609c6bbd8 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv @@ -3108,7 +3108,7 @@ "@stdlib/array/uint32",Uint32Array "@stdlib/process/umask",umask "@stdlib/string/uncapitalize",uncapitalize -"@stdlib/utils/uncapitalize-keys",uncapitalizeKeys +"@stdlib/object/uncapitalize-keys",uncapitalizeKeys "@stdlib/utils/uncurry",uncurry "@stdlib/utils/uncurry-right",uncurryRight "@stdlib/constants/unicode/max",UNICODE_MAX diff --git a/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv index c5f486a5bc4e..9c64b0941945 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/utils/uncapitalize-keys,@stdlib/utils/uppercase-keys" +"@stdlib/object/capitalize-keys","@stdlib/object/uncapitalize-keys,@stdlib/utils/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/utils/lowercase-keys","@stdlib/utils/uncapitalize-keys,@stdlib/utils/uppercase-keys" +"@stdlib/utils/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/utils/uncapitalize-keys","@stdlib/object/capitalize-keys,@stdlib/utils/lowercase-keys" +"@stdlib/object/uncapitalize-keys","@stdlib/object/capitalize-keys,@stdlib/utils/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" diff --git a/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv index b1e07e1dd2dd..17af207f89cf 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv @@ -3108,7 +3108,7 @@ "@stdlib/array/uint32","@stdlib/array-uint32" "@stdlib/process/umask","@stdlib/process-umask" "@stdlib/string/uncapitalize","@stdlib/string-uncapitalize" -"@stdlib/utils/uncapitalize-keys","@stdlib/utils-uncapitalize-keys" +"@stdlib/object/uncapitalize-keys","@stdlib/object-uncapitalize-keys" "@stdlib/utils/uncurry","@stdlib/utils-uncurry" "@stdlib/utils/uncurry-right","@stdlib/utils-uncurry-right" "@stdlib/constants/unicode/max","@stdlib/constants-unicode-max" diff --git a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv index 9e24647fe6af..ce3b71024f23 100644 --- a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv @@ -3108,7 +3108,7 @@ "@stdlib/array-uint32","@stdlib/array/uint32" "@stdlib/process-umask","@stdlib/process/umask" "@stdlib/string-uncapitalize","@stdlib/string/uncapitalize" -"@stdlib/utils-uncapitalize-keys","@stdlib/utils/uncapitalize-keys" +"@stdlib/object-uncapitalize-keys","@stdlib/object/uncapitalize-keys" "@stdlib/utils-uncurry","@stdlib/utils/uncurry" "@stdlib/utils-uncurry-right","@stdlib/utils/uncurry-right" "@stdlib/constants-unicode-max","@stdlib/constants/unicode/max" diff --git a/lib/node_modules/@stdlib/object/capitalize-keys/README.md b/lib/node_modules/@stdlib/object/capitalize-keys/README.md index ba83a6f72a6e..1df7740eacf9 100644 --- a/lib/node_modules/@stdlib/object/capitalize-keys/README.md +++ b/lib/node_modules/@stdlib/object/capitalize-keys/README.md @@ -115,7 +115,7 @@ console.dir( obj2 ); ## See Also -- [`@stdlib/utils/uncapitalize-keys`][@stdlib/utils/uncapitalize-keys]: convert the first letter of each object key to lowercase. +- [`@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. @@ -128,7 +128,7 @@ console.dir( obj2 ); -[@stdlib/utils/uncapitalize-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/uncapitalize-keys +[@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 diff --git a/lib/node_modules/@stdlib/utils/lowercase-keys/README.md b/lib/node_modules/@stdlib/utils/lowercase-keys/README.md index 6aac94acd0f4..700ff2e7d66e 100644 --- a/lib/node_modules/@stdlib/utils/lowercase-keys/README.md +++ b/lib/node_modules/@stdlib/utils/lowercase-keys/README.md @@ -115,7 +115,7 @@ console.dir( obj2 ); ## See Also -- [`@stdlib/utils/uncapitalize-keys`][@stdlib/utils/uncapitalize-keys]: convert the first letter of each object key to lowercase. +- [`@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. @@ -128,7 +128,7 @@ console.dir( obj2 ); -[@stdlib/utils/uncapitalize-keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/uncapitalize-keys +[@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 From beeb09a3de878f5e3eccf4be6a5c0e1867cbd90b Mon Sep 17 00:00:00 2001 From: NEERAJ Date: Sun, 21 Dec 2025 12:07:08 +0530 Subject: [PATCH 4/4] remove: remove `utils/uncapitalize-keys` This commit removes `@stdlib/utils/uncapitalize-keys` in favor of `@stdlib/object/uncapitalize-keys`. BREAKING CHANGE: remove `utils/uncapitalize-keys` To migrate, users should update their require/import paths to use `@stdlib/object/uncapitalize-keys` which provides the same API and implementation. Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/utils/uncapitalize-keys/README.md | 139 ------------- .../uncapitalize-keys/benchmark/benchmark.js | 57 ------ .../utils/uncapitalize-keys/docs/repl.txt | 28 --- .../uncapitalize-keys/docs/types/index.d.ts | 46 ----- .../uncapitalize-keys/docs/types/test.ts | 33 --- .../utils/uncapitalize-keys/examples/index.js | 33 --- .../utils/uncapitalize-keys/lib/index.js | 45 ---- .../utils/uncapitalize-keys/lib/main.js | 69 ------- .../utils/uncapitalize-keys/package.json | 76 ------- .../utils/uncapitalize-keys/test/test.js | 193 ------------------ 10 files changed, 719 deletions(-) delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/README.md delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/examples/index.js delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/lib/index.js delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/lib/main.js delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/package.json delete mode 100644 lib/node_modules/@stdlib/utils/uncapitalize-keys/test/test.js diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/README.md b/lib/node_modules/@stdlib/utils/uncapitalize-keys/README.md deleted file mode 100644 index e7035fabed5a..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-keys/README.md +++ /dev/null @@ -1,139 +0,0 @@ - - -# uncapitalizeKeys - -> Convert the first letter of each object key to lowercase. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var uncapitalizeKeys = require( '@stdlib/utils/uncapitalize-keys' ); -``` - -#### uncapitalizeKeys( obj ) - -Converts the first letter of each `object` key to lowercase, mapping the transformed keys to a new `object` having the same values. - -```javascript -var obj1 = { - 'BeepBoop': 1, - 'FooBar': 2 -}; - -var obj2 = uncapitalizeKeys( obj1 ); -// returns { 'beepBoop': 1, 'fooBar': 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 uncapitalizeKeys = require( '@stdlib/utils/uncapitalize-keys' ); - -var obj1 = { - 'AA': 'beep', - 'BB': 'boop', - 'CC': 'foo', - 'DD': 'bar' -}; - -var obj2 = uncapitalizeKeys( obj1 ); - -console.dir( obj2 ); -// => { 'aA': 'beep', 'bB': 'boop', 'cC': 'foo', 'dD': 'bar' } -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/benchmark/benchmark.js b/lib/node_modules/@stdlib/utils/uncapitalize-keys/benchmark/benchmark.js deleted file mode 100644 index 21c81d9b6b2c..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-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 uncapitalizeKeys = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var obj; - var out; - var i; - - obj = { - 'AA': 'beep', - 'BB': 'boop', - 'CC': 'foo', - 'DD': 'bar', - 'EE': randu() - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - obj.EE = randu(); - out = uncapitalizeKeys( 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/uncapitalize-keys/docs/repl.txt b/lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/repl.txt deleted file mode 100644 index 6a7206433fec..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( obj ) - Converts the first letter of 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 = { 'AA': 1, 'BB': 2 }; - > var out = {{alias}}( obj ) - { 'aA': 1, 'bB': 2 } - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/types/index.d.ts deleted file mode 100644 index 7cf075148558..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-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 the first letter of 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 = { -* 'AA': 1, -* 'BB': 2 -* }; -* -* var obj2 = uncapitalizeKeys( obj1 ); -* // returns { 'aA': 1, 'bB': 2 } -*/ -declare function uncapitalizeKeys( obj: Object ): Object; - - -// EXPORTS // - -export = uncapitalizeKeys; diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/types/test.ts b/lib/node_modules/@stdlib/utils/uncapitalize-keys/docs/types/test.ts deleted file mode 100644 index 36ec97ebe648..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-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 uncapitalizeKeys = require( './index' ); - - -// TESTS // - -// The function returns an object... -{ - uncapitalizeKeys( { 'a': 1, 'b': 2 } ); // $ExpectType Object -} - -// The compiler throws an error if the function is provided an incorrect number of arguments... -{ - uncapitalizeKeys(); // $ExpectError - uncapitalizeKeys( [], 2 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/examples/index.js b/lib/node_modules/@stdlib/utils/uncapitalize-keys/examples/index.js deleted file mode 100644 index 69e6bd086d64..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-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 uncapitalizeKeys = require( './../lib' ); - -var obj1 = { - 'AA': 'beep', - 'BB': 'boop', - 'CC': 'foo', - 'DD': 'bar' -}; - -var obj2 = uncapitalizeKeys( obj1 ); - -console.dir( obj2 ); -// => { 'aA': 'beep', 'bB': 'boop', 'cC': 'foo', 'dD': 'bar' } diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/lib/index.js b/lib/node_modules/@stdlib/utils/uncapitalize-keys/lib/index.js deleted file mode 100644 index 83fb585a812b..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-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 the first letter of each object key to lowercase. -* -* @module @stdlib/utils/uncapitalize-keys -* -* @example -* var uncapitalizeKeys = require( '@stdlib/utils/uncapitalize-keys' ); -* -* var obj1 = { -* 'AA': 1, -* 'BB': 2 -* }; -* -* var obj2 = uncapitalizeKeys( obj1 ); -* // returns { 'aA': 1, 'bB': 2 } -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/lib/main.js b/lib/node_modules/@stdlib/utils/uncapitalize-keys/lib/main.js deleted file mode 100644 index feb21d598eae..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-keys/lib/main.js +++ /dev/null @@ -1,69 +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 the first letter of each object key to lowercase. -* -* @param {Object} obj - source object -* @throws {TypeError} must provide an object -* @returns {Object} new object -* -* @example -* var obj1 = { -* 'AA': 1, -* 'BB': 2 -* }; -* -* var obj2 = uncapitalizeKeys( obj1 ); -* // returns { 'aA': 1, 'bB': 2 } -*/ -function uncapitalizeKeys( obj ) { - var out; - var key; - var k; - 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 ) ) { - if ( key === '' ) { - out[ key ] = obj[ key ]; - } else { - k = key.charAt( 0 ).toLowerCase() + key.slice( 1 ); - out[ k ] = obj[ key ]; - } - } - } - return out; -} - - -// EXPORTS // - -module.exports = uncapitalizeKeys; diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/package.json b/lib/node_modules/@stdlib/utils/uncapitalize-keys/package.json deleted file mode 100644 index 321823a16b21..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-keys/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@stdlib/utils/uncapitalize-keys", - "version": "0.0.0", - "description": "Convert the first letter of 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", - "uncapitalize", - "lowercase", - "first", - "copy", - "cp", - "clone", - "extract", - "property", - "props", - "properties", - "keys", - "object", - "array", - "obj" - ] -} diff --git a/lib/node_modules/@stdlib/utils/uncapitalize-keys/test/test.js b/lib/node_modules/@stdlib/utils/uncapitalize-keys/test/test.js deleted file mode 100644 index 212f663cd18d..000000000000 --- a/lib/node_modules/@stdlib/utils/uncapitalize-keys/test/test.js +++ /dev/null @@ -1,193 +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 uncapitalizeKeys = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof uncapitalizeKeys, '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() { - uncapitalizeKeys( value ); - }; - } -}); - -tape( 'the function lowercases the first letter of each key 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 = { - '': 0, - 'beep': 3.14, - ' Boop': -1.0, - 'AA': 1, - 'BB': 2, - 'CC': 3, - 'DD': 4, - 'EE': 5 - }; - - obj2 = uncapitalizeKeys( obj1 ); - - expected = { - '': 0, - 'beep': 3.14, - ' Boop': -1.0, - 'aA': 1, - 'bB': 2, - 'cC': 3, - 'dD': 4, - 'eE': 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.AA = 1; - this.BB = 2; - this.CC = 3; - this.DD = 4; - this.EE = 5; - return this; - } - - Foo.prototype.FF = 6; - Foo.prototype.GG = 7; - - obj1 = new Foo(); - - obj2 = uncapitalizeKeys( obj1 ); - - expected = { - 'aA': 1, - 'bB': 2, - 'cC': 3, - 'dD': 4, - 'eE': 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 = uncapitalizeKeys( 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 = { - 'AA': [ 1 ], - 'BB': [ 2 ], - 'CC': [ 3 ], - 'DD': [ 4 ], - 'EE': [ 5 ] - }; - - obj2 = uncapitalizeKeys( obj1 ); - - expected = { - 'aA': obj1.AA, - 'bB': obj1.BB, - 'cC': obj1.CC, - 'dD': obj1.DD, - 'eE': obj1.EE - }; - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.strictEqual( obj2.aA, obj1.AA, 'returns shallow copy' ); - t.strictEqual( obj2.bB, obj1.BB, 'returns shallow copy' ); - t.strictEqual( obj2.cC, obj1.CC, 'returns shallow copy' ); - t.strictEqual( obj2.dD, obj1.DD, 'returns shallow copy' ); - t.strictEqual( obj2.eE, obj1.EE, '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 = uncapitalizeKeys( obj1 ); - - t.deepEqual( obj2, expected, 'returns expected object' ); - t.end(); -});