
Research
/Security News
PolinRider Spreads Through Compromised GitHub Accounts and Packagist
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.
@voya-kit/snow-id
Advanced tools
重要声明: 本项目 @voya-kit/snow-id 基于的 snowflake-id 进行了导入语法改造与优化。我们不仅保留了原项目的精髓,还全面拥抱了现代JavaScript生态,确保了对 CommonJS (CJS) 和 ECMAScript Modules (ESM) 两种模块化标准的支持。
mid) 和时间偏移 (offset) 参数,适应多样化的部署环境。执行以下命令,即可将 @voya-kit/snow-id 添加到您的项目依赖中:
npm install @voya-kit/snow-id --save
对于传统的Node.js应用或者那些仍使用CJS模块系统的项目,您可以这样导入:
const { SnowflakeId } = require('@voya-kit/snow-id');
// 初始化Snowflake实例
const snowflake = new SnowflakeId(
{ mid: 1, // 示例值,建议根据实际情况设置唯一机器标识
offset: 0, // 可选,时间偏移量,用于调整ID起始时间
}
);
随着JavaScript模块标准的发展,越来越多的新项目倾向于使用ESM。如果您处于这样的开发环境,请使用以下导入语句:
import { SnowflakeId } from '@voya-kit/snow-id';
// 初始化Snowflake实例
const snowflake = new SnowflakeId({
mid: 1, // 示例值,建议根据实际情况设置唯一机器标识
offset: 0, // 可选,时间偏移量,用于调整ID起始时间
})
无论是CJS还是ESM导入方式,生成ID的逻辑保持一致:
const id1 = snowflake.generate(); // 生成如 "285124269753503744" 的唯一ID
const id2 = snowflake.generate(); // 每次调用生成不同的ID
支持CJS或ESM的JavaScript项目中轻松集成并利用 @voya-kit/snow-id 来生成高性能、高可用的唯一标识符。
FAQs
雪花ID,核心来自snowflake-id,支持CJS & EMS导入
We found that @voya-kit/snow-id demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.

Company News
Allow myself to introduce... myself.