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

@palxp/ijs-utils

v0.0.4

Published

<dl> <dt><a href="#arrayEqual">`arrayEqual(arr1, arr2)`</a> ⇒ <code>Boolean</code></dt> <dd><p>判断两个数组是否相等</p> </dd> <dt><a href="#fuzzyQuery">`fuzzyQuery(list, field, keyWord)`</a> ⇒ <code>Array</code></dt> <dd><p>对象数组模糊查询</p> </dd> <dt><a href="#objArray

Downloads

2

Readme

Functions

arrayDelRepetitiveArray

数组去重

Kind: global Array - 数组类函数
Returns: Array - eg: arrayDelRepetitive([1,2],[2,5],[3,5,9]) // [1, 2, 5, 3, 9]

| Param | Type | Description | | --- | --- | --- | | arr1 | Array | 去重的对象 | | ...arr2 | Array | 可以同时合并多个数组之后再去重 |

arrayEqual(arr1, arr2)Boolean

判断两个数组是否相等

Kind: global function

| Param | Type | | --- | --- | | arr1 | Array | | arr2 | Array |

fuzzyQuery(list, field, keyWord)Array

对象数组模糊查询

Kind: global function
Returns: Array - 查询的结果 eg: fuzzyQuery([{key:123},{key:62},{key:7}], 'key', 2) // [{key:123},{key:62}]

| Param | Type | Description | | --- | --- | --- | | list | Array | 原数组 | | field | String | 对应字段 | | keyWord | String | 查询的关键词 |

objArrayDelRepetitive(arr, 对象中相同的关键字(如id))Array

对象数组去重

Kind: global function

| Param | Type | | --- | --- | | arr | Array | | 对象中相同的关键字(如id) | String |

throttle(delay, noTrailing, callback, debounceMode)function

函数节流。 适用于限制resizescroll等函数的调用频率

Kind: global function
Returns: function - 新的节流函数

| Param | Type | Description | | --- | --- | --- | | delay | Number | 0 或者更大的毫秒数。 对于事件回调,大约100或250毫秒(或更高)的延迟是最有用的。 | | noTrailing | Boolean | 可选,默认为false。 如果noTrailing为true,当节流函数被调用,每过delay毫秒callback也将执行一次。 如果noTrailing为false或者未传入,callback将在最后一次调用节流函数后再执行一次. (延迟delay毫秒之后,节流函数没有被调用,内部计数器会复位) | | callback | function | 延迟毫秒后执行的函数。this上下文和所有参数都是按原样传递的, 执行去节流功能时,调用callback。 | | debounceMode | Boolean | 如果debounceMode为true,cleardelayms后执行。 如果debounceMode是false,callbackdelay ms之后执行。 |

debounce(delay, atBegin, callback)function

函数防抖 与throttle不同的是,debounce保证一个函数在多少毫秒内不再被触发,只会执行一次, 要么在第一次调用return的防抖函数时执行,要么在延迟指定毫秒后调用。

Kind: global function
Returns: function - 新的防抖函数。

| Param | Type | Description | | --- | --- | --- | | delay | Number | 0或者更大的毫秒数。 对于事件回调,大约100或250毫秒(或更高)的延迟是最有用的。 | | atBegin | Boolean | 可选,默认为false。 如果atBegin为false或未传入,回调函数则在第一次调用return的防抖函数后延迟指定毫秒调用。 如果atBegin为true,回调函数则在第一次调用return的防抖函数时直接执行 | | callback | function | 延迟毫秒后执行的函数。this上下文和所有参数都是按原样传递的, 执行去抖动功能时,,调用callback。 |

Example

适用场景:如在线编辑的自动存储防抖。

deepClone(values)Any

深拷贝,支持常见类型

Kind: global function

| Param | Type | | --- | --- | | values | Any |

isEmptyObject(obj)Boolean

判断obj是否为空

Kind: global function

| Param | Type | | --- | --- | | obj | Object |

randomColor(title, author)String

随机生成颜色

Kind: global function
Returns: String - color

| Param | Type | Description | | --- | --- | --- | | title | string | The title of the book. | | author | string | The author of the book. |

randomNum(min, max, title, author)

生成指定范围[min, max]的随机数

Kind: global function

| Param | Type | Description | | --- | --- | --- | | min | Number | | | max | Number | | | title | string | The title of the book. | | author | string | The author of the book. |