stdlib-js / stdlib-js/stdlib

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

未关闭
#10,935 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
difficulty: 2 Needs Discussion RFC
主要语言
JavaScript
星标
6k
派生
1.3k
平均合并
1 天 3 小时
30 天内合并 PR
611

描述

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

贡献指南

打开贡献指南

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data
Issue 类型
重构
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。