diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/README.md b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/README.md new file mode 100644 index 000000000000..4a8fe1902050 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/README.md @@ -0,0 +1,125 @@ + + +# isSymbolAlias + +> Test if an input value is a supported [symbol alias][@stdlib/plot/base/symbol-aliases]. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var isSymbolAlias = require( '@stdlib/plot/base/assert/is-symbol-alias' ); +``` + +#### isSymbolAlias( value ) + +Tests if an input value is a supported [symbol alias][@stdlib/plot/base/symbol-aliases]. + +```javascript +var bool = isSymbolAlias( 'circle' ); +// returns true + +bool = isSymbolAlias( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +## Notes + +- An alias is the human-readable name of a symbol (e.g., `circle`), as opposed to a [shorthand][@stdlib/plot/base/symbol-shorthands] (e.g., `o`). + +
+ + + + + +
+ +## Examples + + + +```javascript +var isSymbolAlias = require( '@stdlib/plot/base/assert/is-symbol-alias' ); + +var bool = isSymbolAlias( 'circle' ); +// returns true + +bool = isSymbolAlias( 'triangle-up' ); +// returns true + +bool = isSymbolAlias( '' ); +// returns false + +bool = isSymbolAlias( 'foo' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/benchmark/benchmark.js new file mode 100644 index 000000000000..3381953664cd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/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 isSymbolAlias = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var out; + var v; + var i; + + values = [ + 'circle', + 'triangle-up', + + 'foo', + 'bar', + '', + 'beep', + 'boop' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = values[ i%values.length ]; + out = isSymbolAlias( 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-alias/docs/repl.txt b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/docs/repl.txt new file mode 100644 index 000000000000..22491f9614f1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if an input value is a supported symbol alias. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating if an input value is a supported symbol alias. + + Examples + -------- + > var bool = {{alias}}( 'circle' ) + true + > bool = {{alias}}( 'triangle-up' ) + true + > bool = {{alias}}( 'o' ) + false + > bool = {{alias}}( 'beep' ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/docs/types/index.d.ts new file mode 100644 index 000000000000..56552fb902ea --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/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 alias. +* +* @param v - value to test +* @returns boolean indicating whether an input value is a supported symbol alias +* +* @example +* var bool = isSymbolAlias( 'circle' ); +* // returns true +* +* bool = isSymbolAlias( 'o' ); +* // returns false +* +* bool = isSymbolAlias( 'foo' ); +* // returns false +*/ +declare function isSymbolAlias( v: any ): boolean; + + +// EXPORTS // + +export = isSymbolAlias; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/docs/types/test.ts b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/docs/types/test.ts new file mode 100644 index 000000000000..5e87d7d6b0f1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/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 isSymbolAlias = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isSymbolAlias( 'circle' ); // $ExpectType boolean + isSymbolAlias( 'foo' ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isSymbolAlias(); // $ExpectError + isSymbolAlias( undefined, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/examples/index.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/examples/index.js new file mode 100644 index 000000000000..66a5d36ad2c7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/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 isSymbolAlias = require( './../lib' ); + +var bool = isSymbolAlias( 'circle' ); +console.log( bool ); +// => true + +bool = isSymbolAlias( 'triangle-up' ); +console.log( bool ); +// => true + +bool = isSymbolAlias( '' ); +console.log( bool ); +// => false + +bool = isSymbolAlias( 'foo' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/lib/index.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/lib/index.js new file mode 100644 index 000000000000..14c0e9e685a4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/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 alias. +* +* @module @stdlib/plot/base/assert/is-symbol-alias +* +* @example +* var isSymbolAlias = require( '@stdlib/plot/base/assert/is-symbol-alias' ); +* +* var bool = isSymbolAlias( 'circle' ); +* // returns true +* +* bool = isSymbolAlias( 'triangle-up' ); +* // returns true +* +* bool = isSymbolAlias( 'o' ); +* // returns false +* +* bool = isSymbolAlias( '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-alias/lib/main.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/lib/main.js new file mode 100644 index 000000000000..500ad9df554b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/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 symbolAliases = require( '@stdlib/plot/base/symbol-aliases' ); + + +// MAIN // + +/** +* Tests whether an input value is a supported symbol alias. +* +* @name isSymbolAlias +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported symbol alias +* +* @example +* var bool = isSymbolAlias( 'circle' ); +* // returns true +* +* bool = isSymbolAlias( 'triangle-up' ); +* // returns true +* +* bool = isSymbolAlias( 'o' ); +* // returns false +* +* bool = isSymbolAlias( 'foo' ); +* // returns false +*/ +var isSymbolAlias = contains( symbolAliases() ); + + +// EXPORTS // + +module.exports = isSymbolAlias; diff --git a/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/package.json b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/package.json new file mode 100644 index 000000000000..9622f082b0d9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/package.json @@ -0,0 +1,71 @@ +{ + "name": "@stdlib/plot/base/assert/is-symbol-alias", + "version": "0.0.0", + "description": "Test if an input value is a supported symbol alias.", + "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", + "alias", + "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-alias/test/test.js b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/test/test.js new file mode 100644 index 000000000000..8437aae9749b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/base/assert/is-symbol-alias/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 symbolAliases = require( '@stdlib/plot/base/symbol-aliases' ); +var isSymbolAlias = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isSymbolAlias, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a supported symbol alias', function test( t ) { + var values; + var bool; + var i; + + values = symbolAliases(); + for ( i = 0; i < values.length; i++ ) { + bool = isSymbolAlias( 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 alias', 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 = isSymbolAlias( values[ i ] ); + t.strictEqual( bool, false, 'returns expected value when provided '+values[ i ] ); + } + t.end(); +});