npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

anyiutils

v0.0.9

Published

any i utils

Downloads

273

Readme

anyiutils

  1. accAdd: 精确加

  2. accMinus: 精确减

  3. accMul: 精确乘

  4. accDiv: 精确除

  5. strComparator: 字符串比较, 类似 macos 文件夹名称排序比较方式

  6. classof: 获取任意值的类型

  7. isPlainObject: 判断值是否为原始对象

  8. isArray: 判断值是否为数组

  9. deepClone: 深拷贝原始对象和数组

  10. mergeObjects: 将多个原始类型的对象进行深度合并

  11. sleep: 睡眠函数

  12. 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')
    }
})
  1. createCircleBase64: 创建环形进度条 base64 编码
import { createCircleBase64 } from 'anyiutils'
const img = document.createElement('img')
img.src = createCircleBase64({ progress: 50 })
document.body.appendChild(img)
  1. animateNumber: 数字动画
import { animateNumber } from 'anyiutils'

animateNumber({ start: 0, end: 5, callback: console.log })
// 1
// 2
// 3
// 4
// 5 true
  1. NumberContorl 可控数字动画
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)