Skip to content

Commit 45ca891

Browse files
committed
refactor!: rename with alias to ndarrayWith in ndarray
Since `with` is a reserved keyword in JS/TS, the current naming scheme caused errors when generating standalone browser bundles (ESM, UMD, Deno). Renaming the export ensures these succeed. We already follow this pattern in `array/base`, where `with` is exported as `arrayWith`. BREAKING CHANGE: rename `with` to `ndarrayWith` in `ndarray` namespace Users should migrate to the new function name when using it directly via the namespace object. --- 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: passed - task: lint_license_headers status: passed ---
1 parent 6d8afc5 commit 45ca891

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/node_modules/@stdlib/ndarray/docs/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ import ndarray2array = require( '@stdlib/ndarray/to-array' );
101101
import ndarray2json = require( '@stdlib/ndarray/to-json' );
102102
import toReversed = require( '@stdlib/ndarray/to-reversed' );
103103
import vector = require( '@stdlib/ndarray/vector' );
104-
import _with = require( '@stdlib/ndarray/with' );
104+
import ndarrayWith = require( '@stdlib/ndarray/with' );
105105
import zeros = require( '@stdlib/ndarray/zeros' );
106106
import zerosLike = require( '@stdlib/ndarray/zeros-like' );
107107

@@ -2803,13 +2803,13 @@ interface Namespace {
28032803
*
28042804
* var x = ndarray( 'generic', buffer, shape, strides, offset, order );
28052805
*
2806-
* var out = ns.with( x, [ 0, 0 ], 5 );
2806+
* var out = ns.ndarrayWith( x, [ 0, 0 ], 5 );
28072807
* // returns <ndarray>
28082808
*
28092809
* var v = out.get( 0, 0 );
28102810
* // returns 5
28112811
*/
2812-
with: typeof _with;
2812+
ndarrayWith: typeof ndarrayWith;
28132813

28142814
/**
28152815
* Creates a zero-filled array having a specified shape and data type.

lib/node_modules/@stdlib/ndarray/lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,13 +775,13 @@ setReadOnly( ns, 'toReversed', require( '@stdlib/ndarray/to-reversed' ) );
775775
setReadOnly( ns, 'vector', require( '@stdlib/ndarray/vector' ) );
776776

777777
/**
778-
* @name with
778+
* @name ndarrayWith
779779
* @memberof ns
780780
* @readonly
781781
* @type {Function}
782782
* @see {@link module:@stdlib/ndarray/with}
783783
*/
784-
setReadOnly( ns, 'with', require( '@stdlib/ndarray/with' ) );
784+
setReadOnly( ns, 'ndarrayWith', require( '@stdlib/ndarray/with' ) );
785785

786786
/**
787787
* @name zeros

0 commit comments

Comments
 (0)