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

poet-js-utils

v1.0.7

Published

Javascript efficient development tool library

Downloads

2

Readme

目录

  1. multArray 二维数组转换
  2. flatten 扁平化数组
  3. flattenDeep 指定层级扁平化数组
  4. isArrayEqual 检查两个数组各项相等
  5. allEqual 检查数组各项相等
  6. diffArray 具有唯一 array 值的数组
  7. haveArr 具有共同 array 值的数组
  8. uniqueArray 数组去重
  9. uniqueArrayObject 数组对象去重
  10. ascArr 数组升序
  11. descArr 数组降序
  12. shuffle 随机排序
  13. maxArray 数组中最大值
  14. validArray 去除数组中的无效值
  15. 防抖
  16. 节流
  17. 判断数据类型
  18. JS 精度问题
  19. 将树转成一维数组

示例

  1. multArray([1, 2, 3, 4, 5, 6, 7], 2) => [[1, 2], [3, 4], [5, 6], [7]]

  2. flatten([1, [2], [3], [4, 5]]) => [1, 2, 3, 4, 5]

  3. flattenDeep([1, [2, [3, [4]], 5]], 1) => [1, 2, [3, [4]], 5]

  4. isArrayEqual(array, array)、

  5. allEqual(array)

  6. diffArray([1, 2, 6, 7], [1, 2, 9, 5]) => [ 6, 7 ]

  7. haveArr([1, 2, 6, 7], [1, 2, 9, 5]) => [ 1, 2 ]

  8. uniqueArray([1, 2, 2, 3, 4, 4, 5])=> [ 1, 2, 3, 4, 5 ]

  9. debounce(fn, wait) //防抖

  10. throttle(fn, wait) //节流

  11. //判断函数类型 typeFn.String('1') typeFn.Number(1) typeFn.Boolean(false) typeFn.Null(null) typeFn.Array([1, 2]) typeFn.Object({ a: 1 }) typeFn.Function(() => {})

  12. 解决 0.1+0.2 !== 0.3 问题 //加法 calcFn.add(0.1, 0.2) // 0.3

//减法 calcFn.sub(0.1, 0.2) // 0.1

//乘法 calcFn.mul(0.2, 0.3) // 0.06

//乘法 calcFn.div(0.4, 0.2) // 2 13. 解决菜单中含有 children 的对象转化为一维数组