From 653e75fb7446c9fc3704f834d93b40fa7aec46df Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Thu, 14 May 2026 14:02:43 +0530 Subject: [PATCH] feat: add plot/vega/base/assert/is-axis-tick-style --- .../base/assert/is-axis-tick-style/README.md | 119 ++++++++++++++++++ .../is-axis-tick-style/benchmark/benchmark.js | 62 +++++++++ .../assert/is-axis-tick-style/docs/repl.txt | 28 +++++ .../is-axis-tick-style/docs/types/index.d.ts | 45 +++++++ .../is-axis-tick-style/docs/types/test.ts | 34 +++++ .../is-axis-tick-style/examples/index.js | 37 ++++++ .../assert/is-axis-tick-style/lib/index.js | 49 ++++++++ .../assert/is-axis-tick-style/lib/main.js | 55 ++++++++ .../assert/is-axis-tick-style/package.json | 70 +++++++++++ .../assert/is-axis-tick-style/test/test.js | 77 ++++++++++++ 10 files changed, 576 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/README.md create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/examples/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/main.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/package.json create mode 100644 lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/test/test.js diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/README.md b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/README.md new file mode 100644 index 000000000000..8555c1299935 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/README.md @@ -0,0 +1,119 @@ + + +# isAxisTickStyle + +> Test if an input value is a supported [axis tick style][@stdlib/plot/vega/axis/tick-styles]. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var isAxisTickStyle = require( '@stdlib/plot/vega/base/assert/is-axis-tick-style' ); +``` + +#### isAxisTickStyle( value ) + +Tests if an input value is a supported [axis tick style][@stdlib/plot/vega/axis/tick-styles]. + +```javascript +var bool = isAxisTickStyle( 'extent' ); +// returns true + +bool = isAxisTickStyle( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var isAxisTickStyle = require( '@stdlib/plot/vega/base/assert/is-axis-tick-style' ); + +var bool = isAxisTickStyle( 'center' ); +// returns true + +bool = isAxisTickStyle( 'extent' ); +// returns true + +bool = isAxisTickStyle( '' ); +// returns false + +bool = isAxisTickStyle( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/benchmark/benchmark.js new file mode 100644 index 000000000000..b70aaac8bf15 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/benchmark/benchmark.js @@ -0,0 +1,62 @@ +/** +* @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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var isAxisTickStyle = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'center', + 'extent', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isAxisTickStyle( v ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( out ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/repl.txt new file mode 100644 index 000000000000..30469339c1dc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported axis tick style. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported axis tick style. + + Examples + -------- + > var bool = {{alias}}( 'center' ) + true + > bool = {{alias}}( 'extent' ) + true + > bool = {{alias}}( '' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/index.d.ts new file mode 100644 index 000000000000..f65238393d54 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @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 + +/** +* Tests whether an input value is a supported axis tick style. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported axis tick style +* +* @example +* var bool = isAxisTickStyle( 'center' ); +* // returns true +* +* bool = isAxisTickStyle( 'extent' ); +* // returns true +* +* bool = isAxisTickStyle( 'bar' ); +* // returns false +* +* bool = isAxisTickStyle( 'foo' ); +* // returns false +*/ +declare function isAxisTickStyle( v: any ): boolean; + + +// EXPORTS // + +export = isAxisTickStyle; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/test.ts new file mode 100644 index 000000000000..3decbba5408f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/docs/types/test.ts @@ -0,0 +1,34 @@ +/* +* @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 isAxisTickStyle = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isAxisTickStyle( 'extent' ); // $ExpectType boolean + isAxisTickStyle( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isAxisTickStyle(); // $ExpectError + isAxisTickStyle( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/examples/index.js new file mode 100644 index 000000000000..db29b40ec207 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/examples/index.js @@ -0,0 +1,37 @@ +/** +* @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 isAxisTickStyle = require( './../lib' ); + +var bool = isAxisTickStyle( 'center' ); +console.log( bool ); +// => true + +bool = isAxisTickStyle( 'extent' ); +console.log( bool ); +// => true + +bool = isAxisTickStyle( '' ); +console.log( bool ); +// => false + +bool = isAxisTickStyle( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/index.js new file mode 100644 index 000000000000..5e6757c45a40 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/index.js @@ -0,0 +1,49 @@ +/** +* @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'; + +/** +* Test whether an input value is a supported axis tick style. +* +* @module @stdlib/plot/vega/base/assert/is-axis-tick-style +* +* @example +* var isAxisTickStyle = require( '@stdlib/plot/vega/base/assert/is-axis-tick-style' ); +* +* var bool = isAxisTickStyle( 'center' ); +* // returns true +* +* bool = isAxisTickStyle( 'extent' ); +* // returns true +* +* bool = isAxisTickStyle( 'bar' ); +* // returns false +* +* bool = isAxisTickStyle( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/main.js new file mode 100644 index 000000000000..6146f57430b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/lib/main.js @@ -0,0 +1,55 @@ +/** +* @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 contains = require( '@stdlib/array/base/assert/contains' ).factory; +var axisTickStyles = require( '@stdlib/plot/vega/axis/tick-styles' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported axis tick style. +* +* @name isAxisTickStyle +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported axis tick style +* +* @example +* var bool = isAxisTickStyle( 'center' ); +* // returns true +* +* bool = isAxisTickStyle( 'extent' ); +* // returns true +* +* bool = isAxisTickStyle( 'bar' ); +* // returns false +* +* bool = isAxisTickStyle( 'foo' ); +* // returns false +*/ +var isAxisTickStyle = contains( axisTickStyles() ); + + +// EXPORTS // + +module.exports = isAxisTickStyle; diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/package.json b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/package.json new file mode 100644 index 000000000000..be8891f4a571 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/plot/vega/base/assert/is-axis-tick-style", + "version": "0.0.0", + "description": "Test if an input value is a supported axis tick style.", + "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", + "base", + "vega", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/test/test.js new file mode 100644 index 000000000000..3efa5c5ebac9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/assert/is-axis-tick-style/test/test.js @@ -0,0 +1,77 @@ +/** +* @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 isAxisTickStyle = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isAxisTickStyle, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported axis tick style', function test( t ) { + var values; + var bool; + var i; + + values = [ + 'center', + 'extent' + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAxisTickStyle( values[ i ] ); + t.strictEqual( bool, true, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +}); + +tape( 'the function returns `false` if not provided a supported axis tick style', function test( t ) { + var values; + var bool; + var i; + + values = [ + '', + 'beep', + 'boop', + 'foo', + 'bar', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + bool = isAxisTickStyle( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +});