Skip to content

Commit 2f21ffb

Browse files
committed
refactor: reduce copy-paste errors by consolidating property names
--- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 45dfa8e commit 2f21ffb

File tree

10 files changed

+138
-22
lines changed

10 files changed

+138
-22
lines changed

lib/node_modules/@stdlib/plot/vega/autosize/lib/change_event.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function event( property ) { // eslint-disable-line stdlib/no-redeclare
3131
return {
3232
'type': 'update',
3333
'source': 'autosize',
34-
'instance': 'Autosize',
3534
'property': property
3635
};
3736
}

lib/node_modules/@stdlib/plot/vega/autosize/lib/contains/get.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var prop = require( './properties.js' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -29,7 +34,7 @@
2934
* @returns {string} method
3035
*/
3136
function get() {
32-
return this._contains;
37+
return this[ prop.private ];
3338
}
3439

3540

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 property2object = require( '@stdlib/plot/vega/base/property2object' );
24+
25+
26+
// MAIN //
27+
28+
var obj = property2object( 'contains' );
29+
30+
31+
// EXPORTS //
32+
33+
module.exports = obj;

lib/node_modules/@stdlib/plot/vega/autosize/lib/contains/set.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ var join = require( '@stdlib/array/base/join' );
2828
var format = require( '@stdlib/string/format' );
2929
var changeEvent = require( './../change_event.js' );
3030
var METHODS = require( './methods.json' );
31+
var prop = require( './properties.js' );
3132

3233

3334
// VARIABLES //
3435

35-
var debug = logger( 'vega:autosize:set:contains' );
36+
var debug = logger( 'vega:autosize:set:'+prop.name );
3637
var isMethod = contains( METHODS );
3738

3839

@@ -48,12 +49,12 @@ var isMethod = contains( METHODS );
4849
*/
4950
function set( value ) {
5051
if ( !isMethod( value ) ) {
51-
throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'contains', join( METHODS, '", "' ), value ) );
52+
throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( METHODS, '", "' ), value ) );
5253
}
53-
if ( value !== this._contains ) {
54-
debug( 'Current value: %s. New value: %s.', this._contains, value );
55-
this._contains = value;
56-
this.emit( 'change', changeEvent( 'contains' ) );
54+
if ( value !== this[ prop.private ] ) {
55+
debug( 'Current value: %s. New value: %s.', this[ prop.private ], value );
56+
this[ prop.private ] = value;
57+
this.emit( 'change', changeEvent( prop.name ) );
5758
}
5859
}
5960

lib/node_modules/@stdlib/plot/vega/autosize/lib/resize/get.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var prop = require( './properties.js' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -29,7 +34,7 @@
2934
* @returns {boolean} boolean flag
3035
*/
3136
function get() {
32-
return this._resize;
37+
return this[ prop.private ];
3338
}
3439

3540

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 property2object = require( '@stdlib/plot/vega/base/property2object' );
24+
25+
26+
// MAIN //
27+
28+
var obj = property2object( 'resize' );
29+
30+
31+
// EXPORTS //
32+
33+
module.exports = obj;

lib/node_modules/@stdlib/plot/vega/autosize/lib/resize/set.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ var logger = require( 'debug' );
2626
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2727
var format = require( '@stdlib/string/format' );
2828
var changeEvent = require( './../change_event.js' );
29+
var prop = require( './properties.js' );
2930

3031

3132
// VARIABLES //
3233

33-
var debug = logger( 'vega:autosize:set:resize' );
34+
var debug = logger( 'vega:autosize:set:'+prop.name );
3435

3536

3637
// MAIN //
@@ -45,12 +46,12 @@ var debug = logger( 'vega:autosize:set:resize' );
4546
*/
4647
function set( value ) {
4748
if ( !isBoolean( value ) ) {
48-
throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'resize', value ) );
49+
throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', prop.name, value ) );
4950
}
50-
if ( value !== this._resize ) {
51-
debug( 'Current value: %s. New value: %s.', this._resize, value );
52-
this._resize = value;
53-
this.emit( 'change', changeEvent( 'resize' ) );
51+
if ( value !== this[ prop.private ] ) {
52+
debug( 'Current value: %s. New value: %s.', this[ prop.private ], value );
53+
this[ prop.private ] = value;
54+
this.emit( 'change', changeEvent( prop.name ) );
5455
}
5556
}
5657

lib/node_modules/@stdlib/plot/vega/autosize/lib/type/get.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// VARIABLES //
24+
25+
var prop = require( './properties.js' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -29,7 +34,7 @@
2934
* @returns {string} type
3035
*/
3136
function get() {
32-
return this._type;
37+
return this[ prop.private ];
3338
}
3439

3540

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 property2object = require( '@stdlib/plot/vega/base/property2object' );
24+
25+
26+
// MAIN //
27+
28+
var obj = property2object( 'type' );
29+
30+
31+
// EXPORTS //
32+
33+
module.exports = obj;

lib/node_modules/@stdlib/plot/vega/autosize/lib/type/set.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ var join = require( '@stdlib/array/base/join' );
2828
var autosizeTypes = require( '@stdlib/plot/vega/base/autosize-types' );
2929
var format = require( '@stdlib/string/format' );
3030
var changeEvent = require( './../change_event.js' );
31+
var prop = require( './properties.js' );
3132

3233

3334
// VARIABLES //
3435

35-
var debug = logger( 'vega:autosize:set:type' );
36+
var debug = logger( 'vega:autosize:set:'+prop.name );
3637

3738

3839
// MAIN //
@@ -47,12 +48,12 @@ var debug = logger( 'vega:autosize:set:type' );
4748
*/
4849
function set( value ) {
4950
if ( !isAutosizeType( value ) ) {
50-
throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'type', join( autosizeTypes(), '", "' ), value ) );
51+
throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', prop.name, join( autosizeTypes(), '", "' ), value ) );
5152
}
52-
if ( value !== this._type ) {
53-
debug( 'Current value: %s. New value: %s.', this._type, value );
54-
this._type = value;
55-
this.emit( 'change', changeEvent( 'type' ) );
53+
if ( value !== this[ prop.private ] ) {
54+
debug( 'Current value: %s. New value: %s.', this[ prop.private ], value );
55+
this[ prop.private ] = value;
56+
this.emit( 'change', changeEvent( prop.name ) );
5657
}
5758
}
5859

0 commit comments

Comments
 (0)