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

@trz/type

v0.5.0

Published

A tool for real type validate.

Downloads

7

Readme

@trz/type

A tool for real type validate.

Install

npm install @trz/type

# Or

yarn add @trz/type

Usage

Import

// ES6
import types, {of, is} from '@trz/type';

// nodejs or broswer
const types  = require('@trz/type');

Interface

function of(source: any): string;

  • Enter an element of any type and return the real type for the element in JavaScript.

  • Example:

    import types from '@trz/type';
      
    types.of(123456789)              //>>> number
      
    types.of('this is a string')     //>>> string
      
    types.of([])                     //>>> array
      
    types.of({})                     //>>> object

function is(source: any, assert: string): boolean

  • Compare whether the source type is the specified type.

  • Example:

    import types from '@trz/type';
    
    types.is([], 'array')              //>>> true
    
    types.is([], 'object')             //>>> false
    
    types.is('123456789', 'string')    //>>> true
    
    types.is(null, 'string')           //>>> false

function some(source: any, asserts: string[]): boolean

  • Verify that the specified element contains the specified type.

  • Example:

    import types from '@trz/type';
    
    types.some([1, 2], ['array', 'object'])      //>>> true
        
    types.some([1, 2], ['object', 'string'])     //>>> false
        
    types.some('1239', ['string'])               //>>> true
        
    types.some(null, ['string'])                 //>>> false

function isInteger(source: any): boolean

  • Verify that the source is an integer type

  • Example:

    import { isInteger } from '@trz/type';
    
    isInteger(12345678)          //>>> true
      
    isInteger(12345.00)          //>>> true
      
    isInteger(0.123456)          //>>> false
      
    isInteger(1.234567)          //>>> false
      
    isInteger('12345678')        //>>> true
      
    isInteger('12345.00')        //>>> true
      
    isInteger('0.123456')        //>>> false
      
    isInteger('1.234567')        //>>> false
      
    isInteger('string')          //>>> false
      
    isInteger([])                //>>> false
      
    (...)