
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
使用二进制位来标记 bool 状态,位数可无限扩展,因为标记位的可扩展性,你需要通过一个数组而不是整数来初始化 BitMarker。 数组中的每个元素可以表示 32 个 bool 状态,当标记数超过 32 时,会自动扩展。
npm install bit-marker
import BitMarker from 'bit-marker';
// 有新功能上线时,出现功能引导,每个功能仅出现一次,使用 BitMarker 对出现过的引导状态进行标记
enum FunctionGuide {
A = 0, // 功能 A
B = 1, // 功能 B
C = 2,
D = 3,
}
// 1. 初始化
const initStatus = []; // 初始标记,从数据库读出或者初始化
const bitMarker = new BitMarker(initStatus);
// 2. 设置标记
// 功能 A 已引导
bitMarker.set(FunctionGuide.A, true);
// 3. 获取标记
const isGuideA = bitMarker.get(FunctionGuide.A);
console.log(isGuideA); // true
const isGuideB = bitMarker.get(FunctionGuide.B);
console.log(isGuideB); // false
初始化,initStatus 为初始标记,从数据库读出或者初始化
设置标记,bit 为标记位,value 为标记值,true 为已标记,false 为未标记。
获取标记,bit 为标记位
接收一个整数数组,每个元素有效值为 [0, 2 ^ 32 - 1],每个数字表示 32 个标记位,当标记数超过 32 时,会自动扩展。
获取所有标记组成的数组。
清空所有标记
FAQs
We found that bit-marker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.