
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
accAdd: 精确加
accMinus: 精确减
accMul: 精确乘
accDiv: 精确除
strComparator: 字符串比较, 类似 macos 文件夹名称排序比较方式
classof: 获取任意值的类型
isPlainObject: 判断值是否为原始对象
isArray: 判断值是否为数组
deepClone: 深拷贝原始对象和数组
mergeObjects: 将多个原始类型的对象进行深度合并
sleep: 睡眠函数
callRetry: 重试函数
import { callRetry } from 'anyiutils'
let count = 0
callRetry({
fn: async () => {
await sleep(100)
console.log('callRetry', count++)
if (count === 2) {
throw new Error('callRetry error')
}
return count
},
onfnend: () => {
console.log('callRetry onfnend')
},
onfnerror: () => {
console.log('callRetry onfnerror')
},
times: 3,
delay: 1000,
onend: () => {
console.log('callRetry onend')
}
})
import { createCircleBase64 } from 'anyiutils'
const img = document.createElement('img')
img.src = createCircleBase64({ progress: 50 })
document.body.appendChild(img)
import { animateNumber } from 'anyiutils'
animateNumber({ start: 0, end: 5, callback: console.log })
// 1
// 2
// 3
// 4
// 5 true
import { NumberContorl } from 'anyiutils'
const nc = new NumberContorl(0)
nc.on('update', (val, isEnd) => {
console.log(val, isEnd)
if (val >= 5) {
nc.seek(0)
}
})
nc.seek(10)
// 1 undefined
// 2 undefined
// 3 undefined
// 4 undefined
// 5 undefined
// 4 undefined
// 3 undefined
// 2 undefined
// 1 undefined
// 0 true
// 结合 NumberContorl 和 createCircleBase64 实现可控制进度与动画的环形进度条
import { NumberContorl, createCircleBase64 } from 'anyiutils'
const img = document.createElement('img')
img.src = createCircleBase64({ progress: 0 })
document.body.appendChild(img)
const nc = new NumberContorl(0, { digits: 0 })
nc.on('update', (val) => {
img.src = createCircleBase64({ progress: val })
})
// 设置进度
nc.seek(10)
nc.seek(100)
nc.seek(0)
FAQs
any i utils
We found that anyiutils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.