diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/README.md b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/README.md new file mode 100644 index 000000000000..adf642c60a98 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/README.md @@ -0,0 +1,125 @@ + + +# isSymbolShorthand + +> Test if an input value is a supported [symbol shorthand][@stdlib/plot/base/symbol-shorthands]. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var isSymbolShorthand = require( '@stdlib/plot/base/assert/is-symbol-shorthand' ); +``` + +#### isSymbolShorthand( value ) + +Tests if an input value is a supported [symbol shorthand][@stdlib/plot/base/symbol-shorthands]. + +```javascript +var bool = isSymbolShorthand( 'o' ); +// returns true + +bool = isSymbolShorthand( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +## Notes + +- A shorthand is a compact symbol notation (e.g., `o`), as opposed to an [alias][@stdlib/plot/base/symbol-aliases] (e.g., `circle`). + +
+ + + + + +
+ +## Examples + + + +```javascript +var isSymbolShorthand = require( '@stdlib/plot/base/assert/is-symbol-shorthand' ); + +var bool = isSymbolShorthand( 'o' ); +// returns true + +bool = isSymbolShorthand( '^' ); +// returns true + +bool = isSymbolShorthand( '' ); +// returns false + +bool = isSymbolShorthand( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/benchmark/benchmark.js new file mode 100644 index 000000000000..47775446b519 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/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 isSymbolShorthand = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'o', + '^', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isSymbolShorthand( 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/base/assert/is-symbol-shorthand/docs/repl.txt b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/docs/repl.txt new file mode 100644 index 000000000000..8bbbe95e01ab --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported symbol shorthand. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported symbol shorthand. + + Examples + -------- + > var bool = {{alias}}( 'o' ) + true + > bool = {{alias}}( '^' ) + true + > bool = {{alias}}( 'circle' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/docs/types/index.d.ts new file mode 100644 index 000000000000..ae3843a36b84 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/docs/types/index.d.ts @@ -0,0 +1,42 @@ +/* +* @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 symbol shorthand. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported symbol shorthand +* +* @example +* var bool = isSymbolShorthand( 'o' ); +* // returns true +* +* bool = isSymbolShorthand( 'circle' ); +* // returns false +* +* bool = isSymbolShorthand( 'foo' ); +* // returns false +*/ +declare function isSymbolShorthand( v: any ): boolean; + + +// EXPORTS // + +export = isSymbolShorthand; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/docs/types/test.ts b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/docs/types/test.ts new file mode 100644 index 000000000000..674a41ecec50 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/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 isSymbolShorthand = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isSymbolShorthand( 'o' ); // $ExpectType boolean + isSymbolShorthand( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isSymbolShorthand(); // $ExpectError + isSymbolShorthand( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/examples/index.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/examples/index.js new file mode 100644 index 000000000000..f6f59bed7866 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/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 isSymbolShorthand = require( './../lib' ); + +var bool = isSymbolShorthand( 'o' ); +console.log( bool ); +// => true + +bool = isSymbolShorthand( '^' ); +console.log( bool ); +// => true + +bool = isSymbolShorthand( '' ); +console.log( bool ); +// => false + +bool = isSymbolShorthand( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/lib/index.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/lib/index.js new file mode 100644 index 000000000000..47575e7ebcd9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/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 symbol shorthand. +* +* @module @stdlib/plot/base/assert/is-symbol-shorthand +* +* @example +* var isSymbolShorthand = require( '@stdlib/plot/base/assert/is-symbol-shorthand' ); +* +* var bool = isSymbolShorthand( 'o' ); +* // returns true +* +* bool = isSymbolShorthand( '^' ); +* // returns true +* +* bool = isSymbolShorthand( 'circle' ); +* // returns false +* +* bool = isSymbolShorthand( 'foo' ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/lib/main.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/lib/main.js new file mode 100644 index 000000000000..3a430b729de2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/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 symbolShorthands = require( '@stdlib/plot/base/symbol-shorthands' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported symbol shorthand. +* +* @name isSymbolShorthand +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported symbol shorthand +* +* @example +* var bool = isSymbolShorthand( 'o' ); +* // returns true +* +* bool = isSymbolShorthand( '^' ); +* // returns true +* +* bool = isSymbolShorthand( 'circle' ); +* // returns false +* +* bool = isSymbolShorthand( 'foo' ); +* // returns false +*/ +var isSymbolShorthand = contains( symbolShorthands() ); + + +// EXPORTS // + +module.exports = isSymbolShorthand; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/package.json b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/package.json new file mode 100644 index 000000000000..09f82b6b8f76 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/package.json @@ -0,0 +1,71 @@ +{ + "name": "@stdlib/plot/base/assert/is-symbol-shorthand", + "version": "0.0.0", + "description": "Test if an input value is a supported symbol shorthand.", + "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", + "symbol", + "shorthand", + "utilities", + "utility", + "utils", + "util", + "assert", + "test", + "check", + "is", + "valid", + "validate", + "validation", + "isvalid" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/test/test.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/test/test.js new file mode 100644 index 000000000000..42eba87d64fa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-shorthand/test/test.js @@ -0,0 +1,75 @@ +/** +* @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 symbolShorthands = require( '@stdlib/plot/base/symbol-shorthands' ); +var isSymbolShorthand = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isSymbolShorthand, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported symbol shorthand', function test( t ) { + var values; + var bool; + var i; + + values = symbolShorthands(); + for ( i = 0; i < values.length; i++ ) { + bool = isSymbolShorthand( 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 symbol shorthand', 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 = isSymbolShorthand( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +});