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

ascor

v1.2.4

Published

一些常用的简单的js工具

Downloads

7

Readme

ascor

介绍

一些常用的 js 工具,ts 编写

安装教程

# 使用npm
npm install ascor

# 使用yarn
yarn add ascor

使用教程

import { isNumber } from "ascor";
//或
import * as asc from "ascor";

isNumber(45); // true
isNumber("45"); // false
isNumber.all("45", 45); // false
isNumber.or("45", 45); // true

asc.isNumber(12); //true
asc.isNumber.all(12, 23); //true
asc.isNumber.or(12, 23, 45); //true

API

is 相关函数

  • isArray 判断是否为数组
  • isDeepEqual 判断两个值是否深度相等
  • isEmail 判断是否为正确的电子邮箱
  • isEmpty 判断是否为空值
  • isNumber 判断是否为 Number 类型
  • isFunction 判断是否为函数
  • isString 判断是否为字符串
  • isNull 判断是否为 null
  • isUndefined 判断是否为 undefined
  • isObject 判断是否为对象
  • isPhone 判断是否为正确的手机号码
  • isTel 判断是否为正确的固定电话号码
  • isPositiveNumber 判断是否为正数
  • isTypeEqual 判断两个值是否类型相同

Array 相关函数

  • arrayHasRepeat 判断数组是否存在重复元素
  • arrayHasValue 判断数组是否存在指定元素
  • arraySort 数组排序
  • arrayUnique 数组去重

date 相关函数

  • Countdown 倒计时类
  • dateFormat 时间格式化
  • delay 延时执行
  • getCurrentTime 获取当前时间
  • Timer 计时器

utils 相关函数

  • createTree 创建树(森林)
  • deepMergeObject 对象深度合并
  • getRanStr 获取随机字符串
  • toThousands 数值每三位加逗号
  • trim 去除字符串首尾空格
  • trimL 去除字符串左边空格
  • trimR 去除字符串右边空格
  • EventEmitter 监听事件
  • Queue 队列执行

前往查看文档