Skip to content

Commit c969262

Browse files
committed
feat: add initial plot/vega/base/transform-validation-message implementation
--- 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: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent e835bf4 commit c969262

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* Transform an "assignment" error message to an "option validation" error message.
23+
*
24+
* @module @stdlib/plot/vega/base/transform-validation-message
25+
*
26+
* @example
27+
* var transformErrorMessage = require( '@stdlib/plot/vega/base/transform-validation-message' );
28+
*
29+
* // TODO: example
30+
*/
31+
32+
// MODULES //
33+
34+
var main = require( './main.js' );
35+
36+
37+
// EXPORTS //
38+
39+
module.exports = main;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var replace = require( '@stdlib/string/base/replace' );
24+
25+
26+
// MAIN //
27+
28+
/**
29+
* Transforms an "assignment" error message to an "option validation" error message.
30+
*
31+
* @param {string} msg - error message
32+
* @returns {string} transformed message
33+
*/
34+
function transformErrorMessage( msg ) {
35+
var m = replace( msg, /invalid assignment\. `([^ ]+)`/, 'invalid option. `$1` option' );
36+
return replace( m, /\. Value:/, '. Option:' );
37+
}
38+
39+
40+
// EXPORTS //
41+
42+
module.exports = transformErrorMessage;
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "@stdlib/plot/vega/base/transform-validation-message",
3+
"version": "0.0.0",
4+
"description": "Transform an assignment error message to an option validation error message.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"lib": "./lib"
19+
},
20+
"types": "./docs/types",
21+
"scripts": {},
22+
"homepage": "https://github.com/stdlib-js/stdlib",
23+
"repository": {
24+
"type": "git",
25+
"url": "git://github.com/stdlib-js/stdlib.git"
26+
},
27+
"bugs": {
28+
"url": "https://github.com/stdlib-js/stdlib/issues"
29+
},
30+
"dependencies": {},
31+
"devDependencies": {},
32+
"engines": {
33+
"node": ">=0.10.0",
34+
"npm": ">2.7.0"
35+
},
36+
"os": [
37+
"aix",
38+
"darwin",
39+
"freebsd",
40+
"linux",
41+
"macos",
42+
"openbsd",
43+
"sunos",
44+
"win32",
45+
"windows"
46+
],
47+
"keywords": [
48+
"stdlib",
49+
"plot",
50+
"vega",
51+
"utilities",
52+
"utility",
53+
"utils",
54+
"util"
55+
],
56+
"__stdlib__": {}
57+
}

0 commit comments

Comments
 (0)