
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@ones-design/utils
Advanced tools
import { Meta } from '@storybook/blocks'
在 ONES Design 中,工具函数是独立维护的。在使用它们之前,你需要先进行安装:
npm install @ones-design/utils
移动列表节点的位置,返回更新后的新数组。
function moveNode<NodeType extends Record<string, any>>(
nodes: NodeType[],
source: number | string,
target: number | string,
): NodeType[]
参数 | 说明 |
---|---|
nodes | 节点数组 |
source | 原位置 |
target | 目标位置 |
移动树节点的位置,返回更新后的新数组。
function moveTreeNode<NodeType extends Record<string, any>>(
nodes: NodeType[],
source: number | string | (number | string)[],
target: number | string | (number | string)[],
pos: -1 | 0 | 1,
childrenName?: string,
): NodeType[]
参数 | 说明 | 默认值 |
---|---|---|
nodes | 节点数组 | |
source | 原位置 | |
target | 目标位置 | |
pos | 相对目标的位置,-1 为上面,0 为里面,1 为下面 | |
childrenName | 存放子节点的字段名 | 'children' |
在指定位置插入节点,返回更新后的新数组。
function insertTreeNode<NodeType extends Record<string, any>>(
nodes: NodeType[],
target: number | string | (number | string)[],
node: NodeType,
pos: -1 | 0 | 1,
childrenName?: string,
): NodeType[]
参数 | 说明 | 默认值 |
---|---|---|
nodes | 节点数组 | |
target | 目标位置 | |
node | 要插入的节点 | |
pos | 相对目标的位置,-1 为上面,0 为里面,1 为下面 | |
childrenName | 存放子节点的字段名 | 'children' |
移除指定位置的节点,返回移除的节点和更新后的新数组。
function removeTreeNode<NodeType extends Record<string, any>>(
nodes: NodeType[],
pos: number | string | (number | string)[],
childrenName?: string,
): {
node: NodeType | null
nodes: NodeType[]
}
参数 | 说明 | 默认值 |
---|---|---|
nodes | 节点数组 | |
pos | 节点位置 | |
childrenName | 存放子节点的字段名 | 'children' |
获取指定位置的节点。
function getTreeNode<NodeType extends Record<string, any>>(
nodes: NodeType[],
pos: number | string | (number | string)[],
childrenName?: string,
): NodeType | null
参数 | 说明 | 默认值 |
---|---|---|
nodes | 节点数组 | |
pos | 节点位置 | |
childrenName | 存放子节点的字段名 | 'children' |
FAQs
ONES Design
We found that @ones-design/utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.