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

@alitajs/autils

v0.6.1

Published

Awesome Utils(前端常用工具方法)

Downloads

90

Readme

Alita NPM version NPM downloads

✨ 特性

  • ✏️ 使用TypeScript编写,类型友好
  • ✨ 源于日常项目的积累,更实用
  • 🐳 使用Jest进行严格测试,更稳定
  • ⚡️ 支持按需加载,请配合babel-plugin-import使用

📦 安装

  • npm安装
npm install @alitajs/autils --save
  • yarn 安装(推荐)
yarn add @alitajs/autils

📝 目录

工具类

  • ArabicChinese 阿拉伯数字和中文数字互转
  • NumberPrecision 解决浮动运算问题,避免小数点后产生多数值和计算精度损失
  • Policy 解析权限策略,并提供验证功能

工具函数

  • arrayToObject 转换数组为对象
  • arrayToTree 将数组转换为树形结构数据
  • dedent 每一行紧跟前导空白的插入值,为多行时,保持缩进。并移除每一行的公共前导空白。
  • deepClone 深拷贝
  • delay 休眠函数
  • forOwn 遍历对象的可枚举属性。若遍历函数返回 false,遍历会提前退出。
  • getType 检测 value 的类型
  • groupBy 根据迭代函数返回的值对 data 进行分组。
  • immediate 推迟执行
  • indent 每一行紧跟前导空白的插入值为多行时,保持缩进。
  • isArray 检查 value 是否是一个数组
  • isBoolean 检查 value 是否是一个布尔值。
  • isDate 检查 value 是否是一个日期
  • isEmail 检查value是否为邮箱。
  • isEmptyObject 检查 obj 是否是一个空对象
  • isFunction 检查 value 是否是一个函数
  • isIdCard 检查 value 是否是一个身份证号
  • isInteger 检查 value 是否是一个整数。
  • isNaN 检查 value 是否是 NaN
  • isNegativeInteger 检查 value 是否是一个负整数
  • isNil 检查 value 是否是 nullundefined
  • isNull 检查 value 是否是 null
  • isNumber 检查 value 是否是一个数字。
  • isObject 检查 value 是否是一个对象
  • isPhone 检查value是否为手机号。
  • isPromise 检查value是否为Promise
  • isRegExp 检查 value 是否是一个正则对象。
  • isString 检查 value 是否是一个字符串
  • isUndefined 检查 value 是否等于 undefined
  • isUrl 检查 value 是否是一个Url
  • urlToList 转换url为数组

工具类型