From d0d9ae3c421196a38962ac418513ef4f2afbd328 Mon Sep 17 00:00:00 2001 From: Neeraj Pathak Date: Wed, 14 Jan 2026 16:50:04 +0530 Subject: [PATCH 1/4] feat: add `object/entries` Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/object/entries/README.md | 123 ++++++++++++++ .../object/entries/benchmark/benchmark.js | 60 +++++++ .../@stdlib/object/entries/docs/repl.txt | 29 ++++ .../object/entries/docs/types/index.d.ts | 50 ++++++ .../@stdlib/object/entries/docs/types/test.ts | 33 ++++ .../@stdlib/object/entries/examples/index.js | 34 ++++ .../@stdlib/object/entries/lib/index.js | 45 +++++ .../@stdlib/object/entries/lib/main.js | 66 ++++++++ .../@stdlib/object/entries/package.json | 73 ++++++++ .../@stdlib/object/entries/test/test.js | 158 ++++++++++++++++++ 10 files changed, 671 insertions(+) create mode 100644 lib/node_modules/@stdlib/object/entries/README.md create mode 100644 lib/node_modules/@stdlib/object/entries/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/object/entries/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/object/entries/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/object/entries/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/object/entries/examples/index.js create mode 100644 lib/node_modules/@stdlib/object/entries/lib/index.js create mode 100644 lib/node_modules/@stdlib/object/entries/lib/main.js create mode 100644 lib/node_modules/@stdlib/object/entries/package.json create mode 100644 lib/node_modules/@stdlib/object/entries/test/test.js diff --git a/lib/node_modules/@stdlib/object/entries/README.md b/lib/node_modules/@stdlib/object/entries/README.md new file mode 100644 index 000000000000..9756ca51c3fd --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/README.md @@ -0,0 +1,123 @@ + + +# Object Entries + +> Return an array of an object's own enumerable property key-value pairs. + +
+ +## Usage + +```javascript +var objectEntries = require( '@stdlib/object/entries' ); +``` + +#### objectEntries( obj ) + +Returns an `array` of an object's own enumerable property `[key, value]` pairs. + +```javascript +var obj = { + 'a': 1, + 'b': 2 +}; + +var entries = objectEntries( obj ); +// e.g., returns [ ['a', 1], ['b', 2] ] +``` + +
+ + + +
+ +## Notes + +- Entry order is not guaranteed, as `object` key enumeration is not specified according to the [ECMAScript specification][ecma-262-for-in]. In practice, however, most engines use insertion order to sort an `object`'s keys, thus allowing for deterministic return values. + +
+ + + +
+ +## Examples + + + +```javascript +var objectEntries = require( '@stdlib/object/entries' ); + +var obj = { + 'beep': 'boop', + 'a': { + 'b': 'c' + }, + 'foo': [ 'bar' ] +}; + +var entries = objectEntries( obj ); +// e.g., returns [ ['beep', 'boop'], ['a', {'b':'c'}], ['foo', [ 'bar' ]] ] +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/object/entries/benchmark/benchmark.js b/lib/node_modules/@stdlib/object/entries/benchmark/benchmark.js new file mode 100644 index 000000000000..ada091c6afd6 --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/benchmark/benchmark.js @@ -0,0 +1,60 @@ +/** +* @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 isArray = require( '@stdlib/assert/is-array' ); +var randu = require( '@stdlib/random/base/randu' ); +var pkg = require( './../package.json' ).name; +var objectEntries = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var obj; + var i; + + obj = { + 'a': 'beep', + 'b': 'boop', + 'c': [ 1, 2, 3 ], + 'd': {}, + 'e': null, + 'f': randu() + }; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + obj.f = randu(); + out = objectEntries( obj ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isArray( out ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/object/entries/docs/repl.txt b/lib/node_modules/@stdlib/object/entries/docs/repl.txt new file mode 100644 index 000000000000..a3a1a3a94458 --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( obj ) + Returns an array of an object's own enumerable property `[key, value]` + pairs. + + Entry order is not guaranteed, as object key enumeration is not specified + according to the ECMAScript specification. In practice, however, most + engines use insertion order to sort an object's keys, thus allowing for + deterministic return values. + + Parameters + ---------- + obj: ObjectLike + Input object. + + Returns + ------- + arr: Array + Array containing key-value pairs. + + Examples + -------- + > var obj = { 'beep': 'boop', 'foo': 'bar' }; + > var entries = {{alias}}( obj ) + e.g., [ [ 'beep', 'boop' ], [ 'foo', 'bar' ] ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/object/entries/docs/types/index.d.ts b/lib/node_modules/@stdlib/object/entries/docs/types/index.d.ts new file mode 100644 index 000000000000..9d06f06d7177 --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/docs/types/index.d.ts @@ -0,0 +1,50 @@ +/* +* @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 + +/** +* Two-element array holding a `key` and corresponding `value`. +*/ +type KeyValuePair = [ string, any ]; + +/** +* Returns an array of an object's own enumerable property `[key, value]` pairs. +* +* ## Notes +* +* - Entry order is not guaranteed, as object key enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's keys, thus allowing for deterministic return values. +* +* @param obj - input object +* @returns array containing key-value pairs +* +* @example +* var obj = { +* 'beep': 'boop', +* 'foo': 'bar' +* }; +* +* var entries = objectEntries( obj ); +* // e.g., returns [ ['beep', 'boop'], ['foo', 'bar'] ] +*/ +declare function objectEntries( obj: any ): Array; + + +// EXPORTS // + +export = objectEntries; diff --git a/lib/node_modules/@stdlib/object/entries/docs/types/test.ts b/lib/node_modules/@stdlib/object/entries/docs/types/test.ts new file mode 100644 index 000000000000..27e46bc60b16 --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/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 objectEntries = require( './index' ); + + +// TESTS // + +// The function returns an array of key-value pairs... +{ + objectEntries( { 'beep': 'boop', 'foo': 3.14 } ); // $ExpectType KeyValuePair[] +} + +// The compiler throws an error if the function is provided an incorrect number of arguments... +{ + objectEntries(); // $ExpectError + objectEntries( {}, 2 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/object/entries/examples/index.js b/lib/node_modules/@stdlib/object/entries/examples/index.js new file mode 100644 index 000000000000..d18546fd8a9d --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/examples/index.js @@ -0,0 +1,34 @@ +/** +* @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 objectEntries = require( './../lib' ); + +var obj = { + 'beep': 'boop', + 'a': { + 'b': 'c' + }, + 'foo': [ 'bar' ] +}; + +var entries = objectEntries( obj ); + +console.log( entries ); +// e.g., => [ ['beep', 'boop'], ['a', {'b':'c'}], ['foo', [ 'bar' ]] ] diff --git a/lib/node_modules/@stdlib/object/entries/lib/index.js b/lib/node_modules/@stdlib/object/entries/lib/index.js new file mode 100644 index 000000000000..e5beabae0a5c --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/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'; + +/** +* Return an array of an object's own enumerable property `[key, value]` pairs. +* +* @module @stdlib/object/entries +* +* @example +* var objectEntries = require( '@stdlib/object/entries' ); +* +* var obj = { +* 'beep': 'boop', +* 'foo': 'bar' +* }; +* +* var entries = objectEntries( obj ); +* // e.g., returns [ ['beep', 'boop'], ['foo', 'bar'] ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/object/entries/lib/main.js b/lib/node_modules/@stdlib/object/entries/lib/main.js new file mode 100644 index 000000000000..1a0c00af2fff --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/lib/main.js @@ -0,0 +1,66 @@ +/** +* @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 objectKeys = require( '@stdlib/utils/keys' ); +var isObjectLike = require( '@stdlib/assert/is-object-like' ); +var format = require( '@stdlib/string/format' ); + + +// MAIN // + +/** +* Returns an array of an object's own enumerable property `[key, value]` pairs. +* +* @param {ObjectLike} obj - input object +* @throws {TypeError} must provide an object-like value +* @returns {Array} array containing key-value pairs +* +* @example +* var obj = { +* 'beep': 'boop', +* 'foo': 'bar' +* }; +* +* var entries = objectEntries( obj ); +* // e.g., returns [ ['beep', 'boop'], ['foo', 'bar'] ] +*/ +function objectEntries( obj ) { + var keys; + var out; + var len; + var i; + if ( !isObjectLike( obj ) ) { + throw new TypeError( format( 'invalid argument. Must provide an object (except null). Value: `%s`.', obj ) ); + } + keys = objectKeys( obj ); + len = keys.length; + out = []; + for ( i = 0; i < len; i++ ) { + out.push( [ keys[i], obj[ keys[i] ] ] ); + } + return out; +} + + +// EXPORTS // + +module.exports = objectEntries; diff --git a/lib/node_modules/@stdlib/object/entries/package.json b/lib/node_modules/@stdlib/object/entries/package.json new file mode 100644 index 000000000000..64b4768d735c --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/object/entries", + "version": "0.0.0", + "description": "Return an array of an object's own enumerable property key-value pairs.", + "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", + "object", + "obj", + "values", + "vals", + "enumerable", + "own", + "properties", + "props", + "key", + "value", + "pairs", + "pair", + "key-value" + ] +} diff --git a/lib/node_modules/@stdlib/object/entries/test/test.js b/lib/node_modules/@stdlib/object/entries/test/test.js new file mode 100644 index 000000000000..d32ed088de92 --- /dev/null +++ b/lib/node_modules/@stdlib/object/entries/test/test.js @@ -0,0 +1,158 @@ +/** +* @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 defineProperty = require( '@stdlib/utils/define-property' ); +var objectEntries = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof objectEntries, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function throws an error if provided a value which is not object-like', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + true, + null, + void 0, + function noop() {} + ]; + + 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() { + objectEntries( value ); + }; + } +}); + +tape( 'the function returns an array of an object\'s own enumerable property `[key, value]` pairs', function test( t ) { + var expected; + var actual; + var obj; + var flg; + var i; + var j; + + obj = { + 'beep': 'boop', + 'a': { + 'b': 'c' + }, + 'foo': [ 'bar' ] + }; + + expected = [ + [ 'beep', obj.beep ], + [ 'a', obj.a ], + [ 'foo', obj.foo ] + ]; + + actual = objectEntries( obj ); + + for ( i = 0; i < expected.length; i++ ) { + flg = false; + for ( j = 0; j < actual.length; j++ ) { + if ( actual[j][0] === expected[i][0] ) { + flg = true; + break; + } + } + if ( flg ) { + t.deepEqual( actual[ j ], expected[ i ], 'contains expected key value pair: '+JSON.stringify( expected[i] ) ); + } else { + t.ok( false, 'did not contain expected key pair: '+JSON.stringify( expected[i] ) ); + } + } + t.end(); +}); + +tape( 'the function ignores prototype properties', function test( t ) { + var expected; + var actual; + var foo; + var flg; + var i; + var j; + + function Foo() { + this.a = 1; + this.b = 2; + return this; + } + Foo.prototype.beep = 'boop'; + + foo = new Foo(); + + actual = objectEntries( foo ); + expected = [ ['a', 1], ['b', 2] ]; + + for ( i = 0; i < expected.length; i++ ) { + flg = false; + for ( j = 0; j < actual.length; j++ ) { + if ( actual[j][0] === expected[i][0] ) { + flg = true; + break; + } + } + if ( flg ) { + t.deepEqual( actual[ j ], expected[ i ], 'contains expected key value pair: '+JSON.stringify( expected[i] ) ); + } else { + t.ok( false, 'did not contain expected key pair: '+JSON.stringify( expected[i] ) ); + } + } + t.end(); +}); + +tape( 'the function ignores non-enumerable properties', function test( t ) { + var expected; + var actual; + var obj; + + obj = {}; + defineProperty( obj, 'foo', { + 'configurable': true, + 'writable': true, + 'enumerable': false, + 'value': 'bar' + }); + + actual = objectEntries( obj ); + expected = []; + + t.deepEqual( actual, expected, 'ignores non-enumerable properties' ); + t.end(); +}); From 3f7628dde7b51747ad8a21a62762f793e5de8258 Mon Sep 17 00:00:00 2001 From: Neeraj Pathak Date: Wed, 14 Jan 2026 16:57:17 +0530 Subject: [PATCH 2/4] remove: remove `objectEntries` from namespace This commit removes the `objectEntries` symbol from the `@stdlib/utils` namespace due to a package migration. BREAKING CHANGE: remove `objectEntries` 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 | 22 ------------------- lib/node_modules/@stdlib/utils/lib/index.js | 9 -------- 2 files changed, 31 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 eba897b1b602..7789f9d16652 100644 --- a/lib/node_modules/@stdlib/utils/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/utils/docs/types/index.d.ts @@ -64,7 +64,6 @@ import doWhile = require( '@stdlib/utils/do-while' ); import doWhileEach = require( '@stdlib/utils/do-while-each' ); import doWhileEachRight = require( '@stdlib/utils/do-while-each-right' ); import dsv = require( '@stdlib/utils/dsv' ); -import objectEntries = require( '@stdlib/utils/entries' ); import objectEntriesIn = require( '@stdlib/utils/entries-in' ); import enumerableProperties = require( '@stdlib/utils/enumerable-properties' ); import enumerablePropertiesIn = require( '@stdlib/utils/enumerable-properties-in' ); @@ -1472,27 +1471,6 @@ interface Namespace { */ dsv: typeof dsv; - /** - * Returns an array of an object's own enumerable property `[key, value]` pairs. - * - * ## Notes - * - * - Entry order is not guaranteed, as object key enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's keys, thus allowing for deterministic return values. - * - * @param obj - input object - * @returns array containing key-value pairs - * - * @example - * var obj = { - * 'beep': 'boop', - * 'foo': 'bar' - * }; - * - * var entries = ns.objectEntries( obj ); - * // e.g., returns [ ['beep', 'boop'], ['foo', 'bar'] ] - */ - objectEntries: typeof objectEntries; - /** * Returns an array of an object's own and inherited enumerable property `[key, value]` pairs. * diff --git a/lib/node_modules/@stdlib/utils/lib/index.js b/lib/node_modules/@stdlib/utils/lib/index.js index 57359b923586..99cddceafbe5 100644 --- a/lib/node_modules/@stdlib/utils/lib/index.js +++ b/lib/node_modules/@stdlib/utils/lib/index.js @@ -436,15 +436,6 @@ setReadOnly( utils, 'doWhileEachRight', require( '@stdlib/utils/do-while-each-ri */ setReadOnly( utils, 'dsv', require( '@stdlib/utils/dsv' ) ); -/** -* @name objectEntries -* @memberof utils -* @readonly -* @type {Function} -* @see {@link module:@stdlib/utils/entries} -*/ -setReadOnly( utils, 'objectEntries', require( '@stdlib/utils/entries' ) ); - /** * @name objectEntriesIn * @memberof utils From 60cd64bbe79210f864366c8a592f6f9cfef4b20b Mon Sep 17 00:00:00 2001 From: Neeraj Pathak Date: Wed, 14 Jan 2026 17:20:09 +0530 Subject: [PATCH 3/4] refactor: update paths Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/namespace/alias2pkg/data/data.csv | 2 +- .../@stdlib/namespace/lib/namespace/n.js | 2 +- .../@stdlib/namespace/lib/namespace/o.js | 10 +++++----- .../@stdlib/namespace/pkg2alias/data/data.csv | 2 +- .../@stdlib/namespace/pkg2related/data/data.csv | 12 ++++++------ .../@stdlib/namespace/pkg2standalone/data/data.csv | 2 +- .../@stdlib/namespace/standalone2pkg/data/data.csv | 2 +- lib/node_modules/@stdlib/utils/entries-in/README.md | 4 ++-- lib/node_modules/@stdlib/utils/keys/README.md | 4 ++-- .../@stdlib/utils/nonindex-keys/README.md | 4 ++-- lib/node_modules/@stdlib/utils/values/README.md | 4 ++-- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv b/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv index e13a5faf4f78..3ced1c982f65 100644 --- a/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/alias2pkg/data/data.csv @@ -2659,7 +2659,7 @@ numel,"@stdlib/ndarray/numel" numelDimension,"@stdlib/ndarray/numel-dimension" numGraphemeClusters,"@stdlib/string/num-grapheme-clusters" Object,"@stdlib/object/ctor" -objectEntries,"@stdlib/utils/entries" +objectEntries,"@stdlib/object/entries" objectEntriesIn,"@stdlib/utils/entries-in" objectFromEntries,"@stdlib/utils/from-entries" objectInverse,"@stdlib/object/inverse" diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/n.js b/lib/node_modules/@stdlib/namespace/lib/namespace/n.js index f4f19fae835e..9f85e49a16a6 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/n.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/n.js @@ -1075,7 +1075,7 @@ ns.push({ 'value': require( '@stdlib/utils/nonindex-keys' ), 'type': 'Function', 'related': [ - '@stdlib/utils/entries', + '@stdlib/object/entries', '@stdlib/utils/keys', '@stdlib/utils/values' ] diff --git a/lib/node_modules/@stdlib/namespace/lib/namespace/o.js b/lib/node_modules/@stdlib/namespace/lib/namespace/o.js index ea3eb3eb89c2..5913fa2badc5 100644 --- a/lib/node_modules/@stdlib/namespace/lib/namespace/o.js +++ b/lib/node_modules/@stdlib/namespace/lib/namespace/o.js @@ -36,8 +36,8 @@ ns.push({ ns.push({ 'alias': 'objectEntries', - 'path': '@stdlib/utils/entries', - 'value': require( '@stdlib/utils/entries' ), + 'path': '@stdlib/object/entries', + 'value': require( '@stdlib/object/entries' ), 'type': 'Function', 'related': [ '@stdlib/utils/entries-in', @@ -53,7 +53,7 @@ ns.push({ 'value': require( '@stdlib/utils/entries-in' ), 'type': 'Function', 'related': [ - '@stdlib/utils/entries', + '@stdlib/object/entries', '@stdlib/utils/from-entries', '@stdlib/utils/keys-in', '@stdlib/utils/values-in' @@ -96,7 +96,7 @@ ns.push({ 'value': require( '@stdlib/utils/keys' ), 'type': 'Function', 'related': [ - '@stdlib/utils/entries', + '@stdlib/object/entries', '@stdlib/utils/keys-in', '@stdlib/utils/nonindex-keys', '@stdlib/utils/values' @@ -109,7 +109,7 @@ ns.push({ 'value': require( '@stdlib/utils/values' ), 'type': 'Function', 'related': [ - '@stdlib/utils/entries', + '@stdlib/object/entries', '@stdlib/utils/keys' ] }); diff --git a/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv index 1d520fb37f1f..dd2f5d80cef4 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2alias/data/data.csv @@ -2659,7 +2659,7 @@ "@stdlib/ndarray/numel-dimension",numelDimension "@stdlib/string/num-grapheme-clusters",numGraphemeClusters "@stdlib/object/ctor",Object -"@stdlib/utils/entries",objectEntries +"@stdlib/object/entries",objectEntries "@stdlib/utils/entries-in",objectEntriesIn "@stdlib/utils/from-entries",objectFromEntries "@stdlib/object/inverse",objectInverse diff --git a/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv index d4a1a58393d6..395c41ff4dee 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2related/data/data.csv @@ -2649,7 +2649,7 @@ "@stdlib/utils/nonenumerable-property-symbols","@stdlib/utils/enumerable-property-symbols,@stdlib/utils/inherited-nonenumerable-property-symbols,@stdlib/utils/nonenumerable-property-names,@stdlib/utils/nonenumerable-property-symbols-in,@stdlib/utils/property-symbols" "@stdlib/utils/nonenumerable-property-symbols-in","@stdlib/utils/enumerable-property-symbols-in,@stdlib/utils/inherited-nonenumerable-property-symbols,@stdlib/utils/nonenumerable-property-names-in,@stdlib/utils/nonenumerable-property-symbols,@stdlib/utils/property-symbols-in" "@stdlib/object/none-own-by","@stdlib/object/any-own-by,@stdlib/object/every-own-by,@stdlib/utils/none-by,@stdlib/object/some-own-by" -"@stdlib/utils/nonindex-keys","@stdlib/utils/entries,@stdlib/utils/keys,@stdlib/utils/values" +"@stdlib/utils/nonindex-keys","@stdlib/object/entries,@stdlib/utils/keys,@stdlib/utils/values" "@stdlib/utils/noop","" "@stdlib/time/now","" "@stdlib/os/num-cpus","" @@ -2659,13 +2659,13 @@ "@stdlib/ndarray/numel-dimension","@stdlib/ndarray/array,@stdlib/ndarray/ctor,@stdlib/ndarray/numel" "@stdlib/string/num-grapheme-clusters","@stdlib/string/next-grapheme-cluster-break" "@stdlib/object/ctor","" -"@stdlib/utils/entries","@stdlib/utils/entries-in,@stdlib/utils/from-entries,@stdlib/utils/keys,@stdlib/utils/values" -"@stdlib/utils/entries-in","@stdlib/utils/entries,@stdlib/utils/from-entries,@stdlib/utils/keys-in,@stdlib/utils/values-in" -"@stdlib/utils/from-entries","@stdlib/utils/entries" +"@stdlib/object/entries","@stdlib/utils/entries-in,@stdlib/utils/from-entries,@stdlib/utils/keys,@stdlib/utils/values" +"@stdlib/utils/entries-in","@stdlib/object/entries,@stdlib/utils/from-entries,@stdlib/utils/keys-in,@stdlib/utils/values-in" +"@stdlib/utils/from-entries","@stdlib/object/entries" "@stdlib/object/inverse","@stdlib/object/inverse-by" "@stdlib/object/inverse-by","@stdlib/object/inverse" -"@stdlib/utils/keys","@stdlib/utils/entries,@stdlib/utils/keys-in,@stdlib/utils/nonindex-keys,@stdlib/utils/values" -"@stdlib/utils/values","@stdlib/utils/entries,@stdlib/utils/keys" +"@stdlib/utils/keys","@stdlib/object/entries,@stdlib/utils/keys-in,@stdlib/utils/nonindex-keys,@stdlib/utils/values" +"@stdlib/utils/values","@stdlib/object/entries,@stdlib/utils/keys" "@stdlib/utils/values-in","@stdlib/utils/entries-in,@stdlib/utils/keys-in,@stdlib/utils/values" "@stdlib/utils/omit","@stdlib/utils/omit-by" "@stdlib/utils/omit-by","@stdlib/utils/omit" diff --git a/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv b/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv index d2a3fc9a8b24..abbb0cb5cd05 100644 --- a/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/pkg2standalone/data/data.csv @@ -2659,7 +2659,7 @@ "@stdlib/ndarray/numel-dimension","@stdlib/ndarray-numel-dimension" "@stdlib/string/num-grapheme-clusters","@stdlib/string-num-grapheme-clusters" "@stdlib/object/ctor","@stdlib/object-ctor" -"@stdlib/utils/entries","@stdlib/utils-entries" +"@stdlib/object/entries","@stdlib/object-entries" "@stdlib/utils/entries-in","@stdlib/utils-entries-in" "@stdlib/utils/from-entries","@stdlib/utils-from-entries" "@stdlib/object/inverse","@stdlib/object-inverse" diff --git a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv index 2d07e48efd95..688b5ecd2821 100644 --- a/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv +++ b/lib/node_modules/@stdlib/namespace/standalone2pkg/data/data.csv @@ -2659,7 +2659,7 @@ "@stdlib/ndarray-numel-dimension","@stdlib/ndarray/numel-dimension" "@stdlib/string-num-grapheme-clusters","@stdlib/string/num-grapheme-clusters" "@stdlib/object-ctor","@stdlib/object/ctor" -"@stdlib/utils-entries","@stdlib/utils/entries" +"@stdlib/object-entries","@stdlib/object/entries" "@stdlib/utils-entries-in","@stdlib/utils/entries-in" "@stdlib/utils-from-entries","@stdlib/utils/from-entries" "@stdlib/object-inverse","@stdlib/object/inverse" diff --git a/lib/node_modules/@stdlib/utils/entries-in/README.md b/lib/node_modules/@stdlib/utils/entries-in/README.md index 0b2f4d32e27f..ccfaf01e12bc 100644 --- a/lib/node_modules/@stdlib/utils/entries-in/README.md +++ b/lib/node_modules/@stdlib/utils/entries-in/README.md @@ -100,7 +100,7 @@ console.log( entries ); ## See Also -- [`@stdlib/utils/entries`][@stdlib/utils/entries]: return an array of an object's own enumerable property key-value pairs. +- [`@stdlib/object/entries`][@stdlib/object/entries]: return an array of an object's own enumerable property key-value pairs. - [`@stdlib/utils/from-entries`][@stdlib/utils/from-entries]: create an object from key-value pairs. - [`@stdlib/utils/keys-in`][@stdlib/utils/keys-in]: return an array of an object's own and inherited enumerable property names. - [`@stdlib/utils/values-in`][@stdlib/utils/values-in]: return an array of an object's own and inherited enumerable property values. @@ -117,7 +117,7 @@ console.log( entries ); -[@stdlib/utils/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/entries +[@stdlib/object/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/entries [@stdlib/utils/from-entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/from-entries diff --git a/lib/node_modules/@stdlib/utils/keys/README.md b/lib/node_modules/@stdlib/utils/keys/README.md index 304a78089412..38cd03a3f428 100644 --- a/lib/node_modules/@stdlib/utils/keys/README.md +++ b/lib/node_modules/@stdlib/utils/keys/README.md @@ -97,7 +97,7 @@ console.log( keys ); ## See Also -- [`@stdlib/utils/entries`][@stdlib/utils/entries]: return an array of an object's own enumerable property key-value pairs. +- [`@stdlib/object/entries`][@stdlib/object/entries]: return an array of an object's own enumerable property key-value pairs. - [`@stdlib/utils/keys-in`][@stdlib/utils/keys-in]: return an array of an object's own and inherited enumerable property names. - [`@stdlib/utils/nonindex-keys`][@stdlib/utils/nonindex-keys]: return an array of an object's own enumerable property names which are not integer indices. - [`@stdlib/utils/values`][@stdlib/utils/values]: return an array of an object's own enumerable property values. @@ -114,7 +114,7 @@ console.log( keys ); -[@stdlib/utils/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/entries +[@stdlib/object/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/entries [@stdlib/utils/keys-in]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/keys-in diff --git a/lib/node_modules/@stdlib/utils/nonindex-keys/README.md b/lib/node_modules/@stdlib/utils/nonindex-keys/README.md index 42b0aa928ff5..bdf85cae8b66 100644 --- a/lib/node_modules/@stdlib/utils/nonindex-keys/README.md +++ b/lib/node_modules/@stdlib/utils/nonindex-keys/README.md @@ -97,7 +97,7 @@ console.log( keys ); ## See Also -- [`@stdlib/utils/entries`][@stdlib/utils/entries]: return an array of an object's own enumerable property key-value pairs. +- [`@stdlib/object/entries`][@stdlib/object/entries]: return an array of an object's own enumerable property key-value pairs. - [`@stdlib/utils/keys`][@stdlib/utils/keys]: return an array of an object's own enumerable property names. - [`@stdlib/utils/values`][@stdlib/utils/values]: return an array of an object's own enumerable property values. @@ -113,7 +113,7 @@ console.log( keys ); -[@stdlib/utils/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/entries +[@stdlib/object/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/entries [@stdlib/utils/keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/keys diff --git a/lib/node_modules/@stdlib/utils/values/README.md b/lib/node_modules/@stdlib/utils/values/README.md index acbe4927b5c6..dfe471626669 100644 --- a/lib/node_modules/@stdlib/utils/values/README.md +++ b/lib/node_modules/@stdlib/utils/values/README.md @@ -91,7 +91,7 @@ var vals = objectValues( obj ); ## See Also -- [`@stdlib/utils/entries`][@stdlib/utils/entries]: return an array of an object's own enumerable property key-value pairs. +- [`@stdlib/object/entries`][@stdlib/object/entries]: return an array of an object's own enumerable property key-value pairs. - [`@stdlib/utils/keys`][@stdlib/utils/keys]: return an array of an object's own enumerable property names. @@ -106,7 +106,7 @@ var vals = objectValues( obj ); -[@stdlib/utils/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/entries +[@stdlib/object/entries]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/object/entries [@stdlib/utils/keys]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/keys From 57208b1902030ad47423acbcd92dbd73469541ac Mon Sep 17 00:00:00 2001 From: Neeraj Pathak Date: Wed, 14 Jan 2026 17:20:55 +0530 Subject: [PATCH 4/4] remove: remove `utils/entries` This commit removes `@stdlib/utils/entries` in favor of `@stdlib/object/entries`. BREAKING CHANGE: remove `utils/entries` To migrate, users should update their require/import paths to use `@stdlib/object/entries` which provides the same API and implementation. Ref: https://github.com/stdlib-js/stdlib/issues/8755 --- .../@stdlib/utils/entries/README.md | 123 -------------- .../utils/entries/benchmark/benchmark.js | 60 ------- .../@stdlib/utils/entries/docs/repl.txt | 29 ---- .../utils/entries/docs/types/index.d.ts | 50 ------ .../@stdlib/utils/entries/docs/types/test.ts | 33 ---- .../@stdlib/utils/entries/examples/index.js | 34 ---- .../@stdlib/utils/entries/lib/index.js | 45 ----- .../@stdlib/utils/entries/lib/main.js | 66 -------- .../@stdlib/utils/entries/package.json | 73 -------- .../@stdlib/utils/entries/test/test.js | 158 ------------------ 10 files changed, 671 deletions(-) delete mode 100644 lib/node_modules/@stdlib/utils/entries/README.md delete mode 100644 lib/node_modules/@stdlib/utils/entries/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/utils/entries/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/utils/entries/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/utils/entries/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/utils/entries/examples/index.js delete mode 100644 lib/node_modules/@stdlib/utils/entries/lib/index.js delete mode 100644 lib/node_modules/@stdlib/utils/entries/lib/main.js delete mode 100644 lib/node_modules/@stdlib/utils/entries/package.json delete mode 100644 lib/node_modules/@stdlib/utils/entries/test/test.js diff --git a/lib/node_modules/@stdlib/utils/entries/README.md b/lib/node_modules/@stdlib/utils/entries/README.md deleted file mode 100644 index a5cce66fe943..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/README.md +++ /dev/null @@ -1,123 +0,0 @@ - - -# Object Entries - -> Return an array of an object's own enumerable property key-value pairs. - -
- -## Usage - -```javascript -var objectEntries = require( '@stdlib/utils/entries' ); -``` - -#### objectEntries( obj ) - -Returns an `array` of an object's own enumerable property `[key, value]` pairs. - -```javascript -var obj = { - 'a': 1, - 'b': 2 -}; - -var entries = objectEntries( obj ); -// e.g., returns [ ['a', 1], ['b', 2] ] -``` - -
- - - -
- -## Notes - -- Entry order is not guaranteed, as `object` key enumeration is not specified according to the [ECMAScript specification][ecma-262-for-in]. In practice, however, most engines use insertion order to sort an `object`'s keys, thus allowing for deterministic return values. - -
- - - -
- -## Examples - - - -```javascript -var objectEntries = require( '@stdlib/utils/entries' ); - -var obj = { - 'beep': 'boop', - 'a': { - 'b': 'c' - }, - 'foo': [ 'bar' ] -}; - -var entries = objectEntries( obj ); -// e.g., returns [ ['beep', 'boop'], ['a', {'b':'c'}], ['foo', [ 'bar' ]] ] -``` - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/utils/entries/benchmark/benchmark.js b/lib/node_modules/@stdlib/utils/entries/benchmark/benchmark.js deleted file mode 100644 index ada091c6afd6..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/benchmark/benchmark.js +++ /dev/null @@ -1,60 +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 isArray = require( '@stdlib/assert/is-array' ); -var randu = require( '@stdlib/random/base/randu' ); -var pkg = require( './../package.json' ).name; -var objectEntries = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var obj; - var i; - - obj = { - 'a': 'beep', - 'b': 'boop', - 'c': [ 1, 2, 3 ], - 'd': {}, - 'e': null, - 'f': randu() - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - obj.f = randu(); - out = objectEntries( obj ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( out ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lib/node_modules/@stdlib/utils/entries/docs/repl.txt b/lib/node_modules/@stdlib/utils/entries/docs/repl.txt deleted file mode 100644 index a3a1a3a94458..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( obj ) - Returns an array of an object's own enumerable property `[key, value]` - pairs. - - Entry order is not guaranteed, as object key enumeration is not specified - according to the ECMAScript specification. In practice, however, most - engines use insertion order to sort an object's keys, thus allowing for - deterministic return values. - - Parameters - ---------- - obj: ObjectLike - Input object. - - Returns - ------- - arr: Array - Array containing key-value pairs. - - Examples - -------- - > var obj = { 'beep': 'boop', 'foo': 'bar' }; - > var entries = {{alias}}( obj ) - e.g., [ [ 'beep', 'boop' ], [ 'foo', 'bar' ] ] - - See Also - -------- - diff --git a/lib/node_modules/@stdlib/utils/entries/docs/types/index.d.ts b/lib/node_modules/@stdlib/utils/entries/docs/types/index.d.ts deleted file mode 100644 index 9d06f06d7177..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/docs/types/index.d.ts +++ /dev/null @@ -1,50 +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 - -/** -* Two-element array holding a `key` and corresponding `value`. -*/ -type KeyValuePair = [ string, any ]; - -/** -* Returns an array of an object's own enumerable property `[key, value]` pairs. -* -* ## Notes -* -* - Entry order is not guaranteed, as object key enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's keys, thus allowing for deterministic return values. -* -* @param obj - input object -* @returns array containing key-value pairs -* -* @example -* var obj = { -* 'beep': 'boop', -* 'foo': 'bar' -* }; -* -* var entries = objectEntries( obj ); -* // e.g., returns [ ['beep', 'boop'], ['foo', 'bar'] ] -*/ -declare function objectEntries( obj: any ): Array; - - -// EXPORTS // - -export = objectEntries; diff --git a/lib/node_modules/@stdlib/utils/entries/docs/types/test.ts b/lib/node_modules/@stdlib/utils/entries/docs/types/test.ts deleted file mode 100644 index 27e46bc60b16..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/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 objectEntries = require( './index' ); - - -// TESTS // - -// The function returns an array of key-value pairs... -{ - objectEntries( { 'beep': 'boop', 'foo': 3.14 } ); // $ExpectType KeyValuePair[] -} - -// The compiler throws an error if the function is provided an incorrect number of arguments... -{ - objectEntries(); // $ExpectError - objectEntries( {}, 2 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/utils/entries/examples/index.js b/lib/node_modules/@stdlib/utils/entries/examples/index.js deleted file mode 100644 index d18546fd8a9d..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/examples/index.js +++ /dev/null @@ -1,34 +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 objectEntries = require( './../lib' ); - -var obj = { - 'beep': 'boop', - 'a': { - 'b': 'c' - }, - 'foo': [ 'bar' ] -}; - -var entries = objectEntries( obj ); - -console.log( entries ); -// e.g., => [ ['beep', 'boop'], ['a', {'b':'c'}], ['foo', [ 'bar' ]] ] diff --git a/lib/node_modules/@stdlib/utils/entries/lib/index.js b/lib/node_modules/@stdlib/utils/entries/lib/index.js deleted file mode 100644 index 779e967ad0ba..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/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'; - -/** -* Return an array of an object's own enumerable property `[key, value]` pairs. -* -* @module @stdlib/utils/entries -* -* @example -* var objectEntries = require( '@stdlib/utils/entries' ); -* -* var obj = { -* 'beep': 'boop', -* 'foo': 'bar' -* }; -* -* var entries = objectEntries( obj ); -* // e.g., returns [ ['beep', 'boop'], ['foo', 'bar'] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/utils/entries/lib/main.js b/lib/node_modules/@stdlib/utils/entries/lib/main.js deleted file mode 100644 index 1a0c00af2fff..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/lib/main.js +++ /dev/null @@ -1,66 +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 objectKeys = require( '@stdlib/utils/keys' ); -var isObjectLike = require( '@stdlib/assert/is-object-like' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Returns an array of an object's own enumerable property `[key, value]` pairs. -* -* @param {ObjectLike} obj - input object -* @throws {TypeError} must provide an object-like value -* @returns {Array} array containing key-value pairs -* -* @example -* var obj = { -* 'beep': 'boop', -* 'foo': 'bar' -* }; -* -* var entries = objectEntries( obj ); -* // e.g., returns [ ['beep', 'boop'], ['foo', 'bar'] ] -*/ -function objectEntries( obj ) { - var keys; - var out; - var len; - var i; - if ( !isObjectLike( obj ) ) { - throw new TypeError( format( 'invalid argument. Must provide an object (except null). Value: `%s`.', obj ) ); - } - keys = objectKeys( obj ); - len = keys.length; - out = []; - for ( i = 0; i < len; i++ ) { - out.push( [ keys[i], obj[ keys[i] ] ] ); - } - return out; -} - - -// EXPORTS // - -module.exports = objectEntries; diff --git a/lib/node_modules/@stdlib/utils/entries/package.json b/lib/node_modules/@stdlib/utils/entries/package.json deleted file mode 100644 index 150b3af2b092..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/utils/entries", - "version": "0.0.0", - "description": "Return an array of an object's own enumerable property key-value pairs.", - "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", - "object", - "obj", - "values", - "vals", - "enumerable", - "own", - "properties", - "props", - "key", - "value", - "pairs", - "pair", - "key-value" - ] -} diff --git a/lib/node_modules/@stdlib/utils/entries/test/test.js b/lib/node_modules/@stdlib/utils/entries/test/test.js deleted file mode 100644 index d32ed088de92..000000000000 --- a/lib/node_modules/@stdlib/utils/entries/test/test.js +++ /dev/null @@ -1,158 +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 defineProperty = require( '@stdlib/utils/define-property' ); -var objectEntries = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof objectEntries, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided a value which is not object-like', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - null, - void 0, - function noop() {} - ]; - - 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() { - objectEntries( value ); - }; - } -}); - -tape( 'the function returns an array of an object\'s own enumerable property `[key, value]` pairs', function test( t ) { - var expected; - var actual; - var obj; - var flg; - var i; - var j; - - obj = { - 'beep': 'boop', - 'a': { - 'b': 'c' - }, - 'foo': [ 'bar' ] - }; - - expected = [ - [ 'beep', obj.beep ], - [ 'a', obj.a ], - [ 'foo', obj.foo ] - ]; - - actual = objectEntries( obj ); - - for ( i = 0; i < expected.length; i++ ) { - flg = false; - for ( j = 0; j < actual.length; j++ ) { - if ( actual[j][0] === expected[i][0] ) { - flg = true; - break; - } - } - if ( flg ) { - t.deepEqual( actual[ j ], expected[ i ], 'contains expected key value pair: '+JSON.stringify( expected[i] ) ); - } else { - t.ok( false, 'did not contain expected key pair: '+JSON.stringify( expected[i] ) ); - } - } - t.end(); -}); - -tape( 'the function ignores prototype properties', function test( t ) { - var expected; - var actual; - var foo; - var flg; - var i; - var j; - - function Foo() { - this.a = 1; - this.b = 2; - return this; - } - Foo.prototype.beep = 'boop'; - - foo = new Foo(); - - actual = objectEntries( foo ); - expected = [ ['a', 1], ['b', 2] ]; - - for ( i = 0; i < expected.length; i++ ) { - flg = false; - for ( j = 0; j < actual.length; j++ ) { - if ( actual[j][0] === expected[i][0] ) { - flg = true; - break; - } - } - if ( flg ) { - t.deepEqual( actual[ j ], expected[ i ], 'contains expected key value pair: '+JSON.stringify( expected[i] ) ); - } else { - t.ok( false, 'did not contain expected key pair: '+JSON.stringify( expected[i] ) ); - } - } - t.end(); -}); - -tape( 'the function ignores non-enumerable properties', function test( t ) { - var expected; - var actual; - var obj; - - obj = {}; - defineProperty( obj, 'foo', { - 'configurable': true, - 'writable': true, - 'enumerable': false, - 'value': 'bar' - }); - - actual = objectEntries( obj ); - expected = []; - - t.deepEqual( actual, expected, 'ignores non-enumerable properties' ); - t.end(); -});