
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.
hd-localstorage
Advanced tools
1、存储的数据,带有获取次数记录。常用语运营位展示 n天n次 的业务需求。
2、存储格式支持对象,数组,字符串,number等类型
3、只针对业务中经常使用的场景,代码简单,代码量少
npm install --save hd-localstorage 或 yarn add hd-localstorage
import Frequency from "hd-localstorage" ;
提供了2种常用的方法:get() ,set().
new Frequency(options) --- options配置实例默认值,选填参数
day:2 --- 配置数据过期时间,单位,天。默认无限大
frequency: 3 --- 配置数据最大请求次数,单位,次。默认无限大
let frequency = new Frequency({
day: 2, // 设置默认几天几次,如果不设置,则默认无数天,无数次
frequency: 3
})
方法:set(name, value, params)
参数1:name => 存储的key值
参数2:value => 存储的value值,默认取name值
参数3: options{ day: 几天, frequency: 几次 } =>
day: 单位,天,支持浮点数
frequency: 单位,次,不支持浮点数
nowFrequency: 单位,次,不支持浮点数。当前获取次数,不填,默认为0
frequency.set('name')
frequency.set('name', '张三')
frequency.set('name', '张三',{ day: 1, frequency: 1, nowFrequency: 1 }) //设置一天内只允许获取一次, 并且当前获取次数为1
方法:get(name)
参数1:name => 存储的key值
frequency.get("name") ;
返回值:object || null
注:如果没有存储过,或者存储过期,则返回 null,存储值存在并且在有效期范围内,则返回对象
{
value: "张三" , // 存储的value值
isSafety: true , // 当前获取次数是否在安全值范围内
nowNumber: 1, // 当前获取次数值
maxNumber: 3, // 设置的获取次数限制
}
FAQs
We found that hd-localstorage 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.