@d3fc/d3fc-rebind

中文文档
6.0.1发布于 2020/07/14MITESM + CJS零依赖近 30 天下载 10.7万

Utilities for copying methods from one d3 component to another in a configurable way

原始使用文档
文档目录4 节
  1. Installing
  2. API Reference
  3. Functions
  4. Transform functions

d3fc-rebind

Utilities for copying methods from one D3 component to another in a configurable way

Main D3FC package

Installing

npm install @d3fc/d3fc-rebind

API Reference

Functions

# fc.rebind(target, source, ...names)

Provides the same functionality as d3.rebind -

Copies the methods with the specified names from source to target, and returns target. Calling one of the named methods on the target object invokes the same-named method on the source object, passing any arguments passed to the target method, and using the source object as the this context. If the source method returns the source object, the target method returns the target object (“setter” method); otherwise, the target method returns the return value of the source method (“getter” mode). The rebind operator allows inherited methods (mix-ins) to be rebound to a subclass on a different object.

# fc.rebindAll(target, source, [...transforms])

Provides the same functionality as rebind but copies all properties found on source to target. Optionally, property name transforms can be specified. These receive a source property name and return either the target property name or a falsey value to indicate the property should not be copied.

N.B. This method does not work with properties found on the source object's prototype e.g. d3.dispatch().on. If you need this functionality use rebind.

Transform functions

As well as creating transforms manually, the following may be useful (especially if you're not able to use ES2015 features) -

# fc.exclude(...names)

Exclude a set of property names. Names can be specified as a string or RegExp.

# fc.include(...names)

Include only the set of property names. Names can be specified as a string or RegExp.

# fc.includeMap(mappings)

Include only the set of properties specified by the keys of mappings using their corresponding values as the target property name e.g. { 'sourceName': 'targetName' }.

# fc.prefix(str)

Prefix all property names with str.

版本与发布记录

@d3fc/d3fc-rebind 共发布 13 个版本,首次发布于 2018/08/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.0.1latest2020/07/146 年前
6.0.02020/04/166 年前
5.0.102019/11/286 年前
5.0.92019/09/047 年前
5.0.82019/08/127 年前
5.0.72019/05/287 年前

关于 @d3fc/d3fc-rebind 的常见问题

@d3fc/d3fc-rebind 是什么?

Utilities for copying methods from one d3 component to another in a configurable way

如何安装 @d3fc/d3fc-rebind?

在项目目录运行 npm install @d3fc/d3fc-rebind,或使用 pnpm add / yarn add / bun add。

@d3fc/d3fc-rebind 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/d3fc__d3fc-rebind 是否存在。

@d3fc/d3fc-rebind 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@d3fc/d3fc-rebind 可以商用吗?

@d3fc/d3fc-rebind 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@d3fc/d3fc-rebind 的下载量有多少?

根据 npm 官方下载统计,@d3fc/d3fc-rebind 在 2026/10/11 – 2026/11/09 这 30 天内被下载 107,199 次,日均约 3,573 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@d3fc/d3fc-rebind 还在维护吗?

最新版本 6.0.1 发布于 2020/07/14(6 年前);至今共发布 13 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/08/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。