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

aidly

v1.7.0

Published

Tool library.

Downloads

1,038

Readme

NPM version

English | 简体中文

纯 JavaScript 运行时的一个工具函数集合,能够很好的进行 tree-shaking。

调试平台

https://imtaotao.github.io/aidly/

使用

import { clone } from 'aidly';

console.log(clone(/a/ig)); // `/a/gi`

CDN

<script src="https://unpkg.com/aidly/dist/aidly.umd.js"></script>
<script>
  const { clone } = window.Aidly;
  console.log(clone(/a/ig)); // `/a/gi`
</script>

API

以下是所有的函数。如果您有其他需要的函数,请在 Issues 中添加话题讨论。

https://unpkg.com/browse/aidly/dist/index.d.ts

Api | 描述 -------------------- | -------------------------------------- throttle | Throttle 函数, 第一次调用时,将立即触发函数调用。 debounce | Debounce 函数, 第一次调用时,将立即触发函数调用。 loopSlice | 切片指定次数的循环,默认切片时间为 17mscolors | 一些默认的颜色值。 uuid | 生成一个 uuidnoop | 一个空箭头函数。 qsParse | Query string 解析。 qsStringify | Query string 格式化为字符串。 rgbToHsl | RGB 转换为 HslrgbToHex | RGB 转换为 HexadecimalrgbToAnsi256 | RGB 转换为 Ansi256hslToRgb | Hsl 转换为 RGBhexToRgb | Hexadecimal 转换为 RGBansi256ToRgb | Ansi256 转换为 RGBrandomColor | 生成随机颜色值,默认格式为 RGB 格式。 assert | 断言一个条件。 raf | requestAnimationFrame 的兼容性处理。 now | Date.nowperformance.now 的兼容性处理。 idleCallback | requestIdleCallback 的兼容性处理。 isAbsolute | 判断一个路径在浏览器中是否是绝对路径。 last | 返回数组中的倒数第 n 个元素(默认是最后一个元素)。 uniq | 数组去重。 hasOwn | Object.hasOwnProperty.call 别名. slash | 替换 \/. makeMap | 将 Array<string> 转换为 Record<string, (key) => boolean>decimalPlaces | 返回数字的小数位数。 random | 返回指定范围内的随机数。如果仅指定一个参数 T,则范围默认为 0 ~ Tonce | 生成一个只会执行一次的高阶函数。 sleep | 暂停 n 毫秒,返回一个 promise。 remove | 从 ArraySet 中删除指定元素。 map | 对 ObjectArraySet 执行 map 操作并返回一个全新的副本。 toCamelCase | 将字符串转换为 camelCasepascalCase 命名,默认处理 _-capitalize | 将字符串的首字母转换为大写。 getExtname | 获取 url 的 extnamegetIteratorFn | 获取一个对象的迭代器函数。 sortKeys | 对 Object 的键进行排序并返回一个新的副本。 clearUndef | 从对象中清除 undefined 的值。 pick | 从一个对象中选择所需的属性值并返回一个新的副本。 omit | 从一个对象中过滤传入的属性值并返回一个新的副本。 unindent | 格式化模板字符串 (unindet(string))defered | 返回一个 defered 对象。 supportWasm | 检查当前环境是否支持 WebAssemblyisBrowser | 检查是否处于浏览器环境中。 isNil | 检查一个值是否是 nullundefinedisNumber | 检查一个值是否是 NumberisString | 检查一个值是否是 StringisFunction | 检查一个值是否是 FunctionisObject | 检查一个值是否是 ObjectisPlainObject | 检查一个值是否是 plainObjectisDate | 检查一个值是否是 DateisRegExp | 检查一个值是否是 RegExpisSet | 检查一个值是否是 SetisWeakSet | 检查一个值是否是 WeakSetisMap | 检查一个值是否是 MapisWeakMap | 检查一个值是否是 WeakMapisPromise | 检查一个值是否是 PromiseLikeisPrimitiveValue | 检查一个值是否是原始类型的值。 isEmptyObject | 检查一个对象是否是一个空对象。 isWindow | 检查一个对象是否是 window 对象。 isBase64 | 检查一个字符串是否是有效的 base64 字符串。 isInBounds | 检查数字是否在指定范围内 (isInBounds([1, 5], 2))isIP | 检查是否是有效的 IP 地址。 isDomain | 检查是否是一个有效的 域名isPort | 检查是否是一个有效的 端口isEmail | 检查是否是一个有效的 emailisPhone | 检查是否是一个有效的 手机号码isCNPhone | 检查是否是一个 中国大陆 有效的 手机号码root | 为全局对象提供的别名,兼容不同环境。 inlineString | 将字符串常量化。 exec | 执行一段 js 代码,可以以 cjsesm 和普通模式来执行代码,默认为普通模式。 execMathExpression | 执行数学计算表达式。 batchProcess | 用于事务的批量处理,例如: const set = batchProcess({ ms: 50, process(ls) { ... } });createCacheObject | 创建一个在内存中的缓存系统。 jsonParse | 将 json 字符串解析为对象,能够处理引用关系(包括循环引用)。 jsonStringify | 将对象格式化为 json 字符串,能够处理引用关系(包括循环引用)。 merge | 合并两个 ObjectArray 并返回一个新对象或数组,而不处理循环引用。 clone | 克隆一个允许循环引用的对象,类型包括ObjectArrayTypeArraySetMapRegExpDatePromiseBufferResponsesetter/getterNon-enumerable 属性(默认不克隆)