From a049c92e35bc040ff07c8af71b6fa4e3995ef785 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Tue, 3 Mar 2026 12:02:24 +0530 Subject: [PATCH 1/2] feat: add plot/vega/compare/orders --- .../plot/vega/compare/orders/README.md | 117 ++++++++++++++++++ .../compare/orders/benchmark/benchmark.js | 48 +++++++ .../plot/vega/compare/orders/docs/repl.txt | 17 +++ .../vega/compare/orders/docs/types/index.d.ts | 35 ++++++ .../vega/compare/orders/docs/types/test.ts | 32 +++++ .../vega/compare/orders/examples/index.js | 40 ++++++ .../plot/vega/compare/orders/lib/data.json | 4 + .../plot/vega/compare/orders/lib/index.js | 40 ++++++ .../plot/vega/compare/orders/lib/main.js | 44 +++++++ .../plot/vega/compare/orders/package.json | 64 ++++++++++ .../plot/vega/compare/orders/test/test.js | 47 +++++++ 11 files changed, 488 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/README.md create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/examples/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/lib/data.json create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/package.json create mode 100644 lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/README.md b/lib/node_modules/@stdlib/plot/vega/compare/orders/README.md new file mode 100644 index 000000000000..fcad162d4ef3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/README.md @@ -0,0 +1,117 @@ + + +# compareOrders + +> List of supported Vega compare orders. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var compareOrders = require( '@stdlib/plot/vega/compare/orders' ); +``` + +#### compareOrders() + +Returns a list of compare orders. + +```javascript +var out = compareOrders(); +// returns [ 'ascending', 'descending' ] +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var compareOrders = require( '@stdlib/plot/vega/compare/orders' ); + +var isCompareOrder = contains( compareOrders() ); + +var bool = isCompareOrder( 'ascending' ); +// returns true + +bool = isCompareOrder( 'descending' ); +// returns true + +bool = isCompareOrder( 'beep' ); +// returns false + +bool = isCompareOrder( 'boop' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/benchmark/benchmark.js new file mode 100644 index 000000000000..1ab4e471feb8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var compareOrders = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = compareOrders(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt new file mode 100644 index 000000000000..74cb7c3d63c6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of compare orders. + + Returns + ------- + out: Array + List of compare orders. + + Examples + -------- + > var out = {{alias}}() + [ 'ascending', 'descending' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts new file mode 100644 index 000000000000..af9ae0b31ac4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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 + +/** +* Returns a list of compare orders. +* +* @returns list of compare orders +* +* @example +* var list = compareOrders(); +* // returns [ 'ascending', 'descending' ] +*/ +declare function compareOrders(): Array; + + +// EXPORTS // + +export = compareOrders; diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/test.ts new file mode 100644 index 000000000000..e8638119c934 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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 compareOrders = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + compareOrders(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + compareOrders( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/examples/index.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/examples/index.js new file mode 100644 index 000000000000..e0570324b859 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 contains = require( '@stdlib/array/base/assert/contains' ).factory; +var compareOrders = require( './../lib' ); + +var isCompareOrder = contains( compareOrders() ); + +var bool = isCompareOrder( 'ascending' ); +console.log( bool ); +// => true + +bool = isCompareOrder( 'descending' ); +console.log( bool ); +// => true + +bool = isCompareOrder( 'beep' ); +console.log( bool ); +// => false + +bool = isCompareOrder( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/data.json b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/data.json new file mode 100644 index 000000000000..621056e6f955 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/data.json @@ -0,0 +1,4 @@ +[ + "ascending", + "descending" +] diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js new file mode 100644 index 000000000000..d75763b211df --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 a list of compare orders. +* +* @module @stdlib/plot/vega/compare/orders +* +* @example +* var compareOrders = require( '@stdlib/plot/vega/compare/orders' ); +* +* var out = compareOrders(); +* // returns [ 'ascending', 'descending' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js new file mode 100644 index 000000000000..6f9f893bd44b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of compare orders. +* +* @returns {StringArray} list of compare orders +* +* @example +* var out = orders(); +* // returns [ 'ascending', 'descending' ] +*/ +function orders() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = orders; diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/package.json b/lib/node_modules/@stdlib/plot/vega/compare/orders/package.json new file mode 100644 index 000000000000..41b3c4893a3b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/plot/vega/compare/orders", + "version": "0.0.0", + "description": "List of supported Vega compare orders.", + "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", + "plot", + "vega", + "compare", + "orders", + "sort", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js new file mode 100644 index 000000000000..b2b99e85e996 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 compareOrders = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof compareOrders, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of compare orders', function test( t ) { + var expected; + var actual; + + expected = [ + 'ascending', + 'descending' + ]; + actual = compareOrders(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); From cf38a2e17686a703c9935098e56b8e56302b0398 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 12 Mar 2026 00:16:00 -0700 Subject: [PATCH 2/2] docs: update descriptions --- lib/node_modules/@stdlib/plot/vega/compare/orders/README.md | 4 ++-- .../@stdlib/plot/vega/compare/orders/docs/repl.txt | 4 ++-- .../@stdlib/plot/vega/compare/orders/docs/types/index.d.ts | 4 ++-- .../@stdlib/plot/vega/compare/orders/lib/index.js | 2 +- lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js | 4 ++-- .../@stdlib/plot/vega/compare/orders/package.json | 4 +++- .../@stdlib/plot/vega/compare/orders/test/test.js | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/README.md b/lib/node_modules/@stdlib/plot/vega/compare/orders/README.md index fcad162d4ef3..df78e6624184 100644 --- a/lib/node_modules/@stdlib/plot/vega/compare/orders/README.md +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/README.md @@ -20,7 +20,7 @@ limitations under the License. # compareOrders -> List of supported Vega compare orders. +> List of supported Vega comparison orders. @@ -42,7 +42,7 @@ var compareOrders = require( '@stdlib/plot/vega/compare/orders' ); #### compareOrders() -Returns a list of compare orders. +Returns a list of comparison orders. ```javascript var out = compareOrders(); diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt index 74cb7c3d63c6..058b9f95179c 100644 --- a/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/repl.txt @@ -1,11 +1,11 @@ {{alias}}() - Returns a list of compare orders. + Returns a list of comparison orders. Returns ------- out: Array - List of compare orders. + List of comparison orders. Examples -------- diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts index af9ae0b31ac4..fb255f3e20d8 100644 --- a/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/docs/types/index.d.ts @@ -19,9 +19,9 @@ // TypeScript Version: 4.1 /** -* Returns a list of compare orders. +* Returns a list of comparison orders. * -* @returns list of compare orders +* @returns list of comparison orders * * @example * var list = compareOrders(); diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js index d75763b211df..e9f61919f9e1 100644 --- a/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Return a list of compare orders. +* Return a list of comparison orders. * * @module @stdlib/plot/vega/compare/orders * diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js index 6f9f893bd44b..1033771e9cd5 100644 --- a/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/lib/main.js @@ -26,9 +26,9 @@ var DATA = require( './data.json' ); // MAIN // /** -* Returns a list of compare orders. +* Returns a list of comparison orders. * -* @returns {StringArray} list of compare orders +* @returns {Array} list of comparison orders * * @example * var out = orders(); diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/package.json b/lib/node_modules/@stdlib/plot/vega/compare/orders/package.json index 41b3c4893a3b..1fcea92a2aad 100644 --- a/lib/node_modules/@stdlib/plot/vega/compare/orders/package.json +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/plot/vega/compare/orders", "version": "0.0.0", - "description": "List of supported Vega compare orders.", + "description": "List of supported Vega comparison orders.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", @@ -53,6 +53,8 @@ "plot", "vega", "compare", + "comparison", + "comparator", "orders", "sort", "utilities", diff --git a/lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js b/lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js index b2b99e85e996..f42e2053ff32 100644 --- a/lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js +++ b/lib/node_modules/@stdlib/plot/vega/compare/orders/test/test.js @@ -32,7 +32,7 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function returns a list of compare orders', function test( t ) { +tape( 'the function returns a list of comparison orders', function test( t ) { var expected; var actual;