From 6861d17efa62ebaa7836f31fb34ea88befba22aa Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Fri, 22 May 2026 01:55:11 +0530 Subject: [PATCH] feat: add plot/vega/base/format-types --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../plot/vega/base/format-types/README.md | 117 ++++++++++++++++++ .../base/format-types/benchmark/benchmark.js | 48 +++++++ .../plot/vega/base/format-types/docs/repl.txt | 17 +++ .../base/format-types/docs/types/index.d.ts | 35 ++++++ .../vega/base/format-types/docs/types/test.ts | 32 +++++ .../vega/base/format-types/examples/index.js | 40 ++++++ .../plot/vega/base/format-types/lib/data.json | 5 + .../plot/vega/base/format-types/lib/index.js | 40 ++++++ .../plot/vega/base/format-types/lib/main.js | 44 +++++++ .../plot/vega/base/format-types/package.json | 63 ++++++++++ .../plot/vega/base/format-types/test/test.js | 48 +++++++ 11 files changed, 489 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/README.md create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/examples/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/lib/data.json create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/lib/main.js create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/package.json create mode 100644 lib/node_modules/@stdlib/plot/vega/base/format-types/test/test.js diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/README.md b/lib/node_modules/@stdlib/plot/vega/base/format-types/README.md new file mode 100644 index 000000000000..68f0c1ce1640 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/README.md @@ -0,0 +1,117 @@ + + +# formatTypes + +> List of supported Vega format types. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var formatTypes = require( '@stdlib/plot/vega/base/format-types' ); +``` + +#### formatTypes() + +Returns a list of format types. + +```javascript +var out = formatTypes(); +// returns [ 'number', 'time', 'utc' ] +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var formatTypes = require( '@stdlib/plot/vega/base/format-types' ); + +var isFormatType = contains( formatTypes() ); + +var bool = isFormatType( 'number' ); +// returns true + +bool = isFormatType( 'time' ); +// returns true + +bool = isFormatType( 'beep' ); +// returns false + +bool = isFormatType( 'boop' ); +// returns false +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/vega/base/format-types/benchmark/benchmark.js new file mode 100644 index 000000000000..da412d794afd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/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 formatTypes = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = formatTypes(); + 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/base/format-types/docs/repl.txt b/lib/node_modules/@stdlib/plot/vega/base/format-types/docs/repl.txt new file mode 100644 index 000000000000..8b84292ab507 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Returns a list of format types. + + Returns + ------- + out: Array + List of format types. + + Examples + -------- + > var out = {{alias}}() + [ 'number', 'time', 'utc' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/vega/base/format-types/docs/types/index.d.ts new file mode 100644 index 000000000000..0788f426b862 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/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 format types. +* +* @returns list of format types +* +* @example +* var list = formatTypes(); +* // returns [ 'number', 'time', 'utc' ] +*/ +declare function formatTypes(): Array; + + +// EXPORTS // + +export = formatTypes; diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/docs/types/test.ts b/lib/node_modules/@stdlib/plot/vega/base/format-types/docs/types/test.ts new file mode 100644 index 000000000000..fd615c438856 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/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 formatTypes = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + formatTypes(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + formatTypes( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/examples/index.js b/lib/node_modules/@stdlib/plot/vega/base/format-types/examples/index.js new file mode 100644 index 000000000000..fc9782c1df8f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/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 formatTypes = require( './../lib' ); + +var isFormatType = contains( formatTypes() ); + +var bool = isFormatType( 'number' ); +console.log( bool ); +// => true + +bool = isFormatType( 'time' ); +console.log( bool ); +// => true + +bool = isFormatType( 'beep' ); +console.log( bool ); +// => false + +bool = isFormatType( 'boop' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/lib/data.json b/lib/node_modules/@stdlib/plot/vega/base/format-types/lib/data.json new file mode 100644 index 000000000000..d0ae2ea65a2e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/lib/data.json @@ -0,0 +1,5 @@ +[ + "number", + "time", + "utc" +] diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/lib/index.js b/lib/node_modules/@stdlib/plot/vega/base/format-types/lib/index.js new file mode 100644 index 000000000000..a4abf48db7e1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/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 format types. +* +* @module @stdlib/plot/vega/base/format-types +* +* @example +* var formatTypes = require( '@stdlib/plot/vega/base/format-types' ); +* +* var out = formatTypes(); +* // returns [ 'number', 'time', 'utc' ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/lib/main.js b/lib/node_modules/@stdlib/plot/vega/base/format-types/lib/main.js new file mode 100644 index 000000000000..ee77cf24e5e4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/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 format types. +* +* @returns {StringArray} list of format types +* +* @example +* var out = formatTypes(); +* // returns [ 'number', 'time', 'utc' ] +*/ +function formatTypes() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = formatTypes; diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/package.json b/lib/node_modules/@stdlib/plot/vega/base/format-types/package.json new file mode 100644 index 000000000000..3fa5ed4574d4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/plot/vega/base/format-types", + "version": "0.0.0", + "description": "List of supported Vega format types.", + "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", + "format", + "type", + "utilities", + "utility", + "utils", + "util" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/plot/vega/base/format-types/test/test.js b/lib/node_modules/@stdlib/plot/vega/base/format-types/test/test.js new file mode 100644 index 000000000000..c740bd177b08 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/base/format-types/test/test.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 tape = require( 'tape' ); +var formatTypes = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof formatTypes, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a list of format types', function test( t ) { + var expected; + var actual; + + expected = [ + 'number', + 'time', + 'utc' + ]; + actual = formatTypes(); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +});