[RFC]: replace `copyView` in `ndarray/array/lib/copy_view.js` with `ndarray/copy`
- Vorherrschende Sprache
- JavaScript
- Sterne
- 6k
- Forks
- 1.3k
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 611
Beschreibung
**Description**
In `ndarray/array/lib/copy_view.js`, the `copyView` function manually creates an output buffer, constructs a plain ndarray-like
object, and uses `ndarray/base/assign` to copy data.
The function contains the following TODO comment:
```js
function copyView( arr, dtype ) { // TODO: consider replacing with `@stdlib/ndarray[/base]/copy` once created
```
Now that `ndarray/copy` exists, the manual logic can be replaced by importing `ndarray/copy`, removing the following unnecessary imports:
- `@stdlib/ndarray/base/assert/is-equal-data-type`
- `@stdlib/buffer/alloc-unsafe`
- `@stdlib/ndarray/base/buffer-ctors`
- `@stdlib/ndarray/order`
- `@stdlib/ndarray/base/numel`
- `@stdlib/ndarray/base/shape2strides`
- `@stdlib/ndarray/base/assign`
- `@stdlib/array/base/zeros`
Beitragsleitfaden
Rechercherichtung
Start in ndarray/array/lib/copy_view.js and read the copyView function and its TODO. Replace the manual copying path with ndarray/copy, remove the listed unused imports, and confirm that copyView retains its existing behavior without those dependencies.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- data
- Issue-Typ
- Refactoring
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 55/100