stdlib-js / stdlib-js/stdlib

[RFC]: replace `copyView` in `ndarray/array/lib/copy_view.js` with `ndarray/copy`

Ouverte
#10,935 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
difficulty: 2 Needs Discussion RFC
Langage dominant
JavaScript
Étoiles
6k
Forks
1.3k
Merge moyen
1 j 3 h
PR mergées (30 j)
611

Description

**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`

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
data
Type d'issue
Refactorisation
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
55/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.