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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@eliduty/type

v1.0.3

Published

该工具库主要是类型判断工具库

Downloads

11

Readme

@eliduty/type

npm npm

该工具库主要是类型判断工具库。

安装

npm install @eliduty/type
// 或
yarn add @eliduty/type
// 或
pnpm install @eliduty/type

函数列表


/**
 * 判断一个值是否为指定类型
 * @param val
 * @param type
 * @returns
 */
declare function is(val: unknown, type: string): boolean;
/**
 * 判断变量是否已定义
 * @param val
 * @returns
 */
declare function isDef(val: unknown): boolean;
/**
 * 判断变量值是否为undefined
 * @param val
 * @returns
 */
declare function isUnDef(val: unknown): boolean;
/**
 * 判断变量是否为Object
 * @param val
 * @returns
 */
declare function isObject(val: unknown): val is Record<string, unknown>;
/**
 * 判断是否为空
 * @param val
 * @returns
 */
declare function isEmpty(val: unknown): boolean;
/**
 * 判断变量是否为Date
 * @param val
 * @returns
 */
declare function isDate(val: unknown): val is Date;
/**
 * 判断变量是否为Null
 * @param val
 * @returns
 */
declare function isNull(val: unknown): val is null;
/**
 * 判断变量是否为undefined或者null
 * @param val
 * @returns
 */
declare function isNullOrDef(val: unknown): val is null | undefined;
/**
 * 判断变量是否为Number
 * @param val
 * @returns
 */
declare function isNumber(val: unknown): val is number;
/**
 * 判断是否为String
 * @param val
 * @returns
 */
declare function isString(val: unknown): val is string;
/**
 * 判断是否为Function
 * @param val
 * @returns
 */
declare function isFunction(val: unknown): boolean;
/**
 * 判断是否为Boolean
 * @param val
 * @returns
 */
declare function isBoolean(val: unknown): val is boolean;
/**
 * 判断是否为RegExp
 * @param val
 * @returns
 */
declare function isRegExp(val: unknown): val is RegExp;
/**
 * 判断是否为Array
 * @param val
 * @returns
 */
declare function isArray(val: any): val is any[];
/**
 * 判断是否为Window对象
 * @param val
 * @returns
 */
declare function isWindow(val: unknown): val is Window;
/**
 * 判断是否为Element
 * @param val
 * @returns
 */
declare function isElement(val: unknown): val is Element;
/**
 * 判断是否是服务端
 * @returns
 */
declare function isServer(): boolean;
/**
 * 判断是否为浏览器客户端
 * @returns
 */
declare function isClient(): boolean;