Skip to content

Commit 5d4b368

Browse files
committed
chore: add isUndefined assertion
--- 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: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 58f1633 commit 5d4b368

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • lib/node_modules/@stdlib/plot/vega/mark/symbol/lib/size

lib/node_modules/@stdlib/plot/vega/mark/symbol/lib/size/set.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
var logger = require( 'debug' );
2626
var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive;
27+
var isUndefined = require( '@stdlib/assert/is-undefined' );
2728
var format = require( '@stdlib/string/format' );
2829
var changeEvent = require( './../change_event.js' );
2930
var prop = require( './properties.js' );
@@ -39,13 +40,17 @@ var debug = logger( 'vega:symbol-mark:set:'+prop.name );
3940
/**
4041
* Sets the symbol size.
4142
*
43+
* ## Notes
44+
*
45+
* - Providing `undefined` "unsets" the configured value.
46+
*
4247
* @private
4348
* @param {void|NonNegativeNumber} value - input value
4449
* @throws {TypeError} must be a nonnegative number
4550
* @returns {void}
4651
*/
4752
function set( value ) {
48-
if ( !isNonNegativeNumber( value ) ) {
53+
if ( !isNonNegativeNumber( value ) && !isUndefined( value ) ) {
4954
throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative number. Value: `%s`.', prop.name, value ) );
5055
}
5156
if ( value !== this[ prop.private ] ) {

0 commit comments

Comments
 (0)