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

mazey-taro-utils

v2.0.1

Published

Taro helpers for environment detection, navigation, login, scrolling, toasts, page parameters, and device information.

Readme

mazey-taro-utils

npm version license

Taro helpers for environment detection, navigation, login, scrolling, toasts, page parameters, and device information.

Install

npm install mazey-taro-utils

Quick start

Import helpers from the package root:

import {
  getEnv,
  getWindowSize,
  quickNavigateTo,
  quickToast,
} from "mazey-taro-utils";

quickToast(`Running in ${getEnv() || "an unspecified Taro environment"}`);
quickNavigateTo("profile", {
  params: {
    userId: "42",
  },
});

const { width, height } = getWindowSize();
console.log({ width, height });

Public API

Page information

  • getCurrentPage() returns the current Taro route without its query string.
  • getAllParams() returns the current route parameters, or an empty object.
  • getQueryParam(name) returns one route parameter, or an empty string.
import { getAllParams, getCurrentPage, getQueryParam } from "mazey-taro-utils";

console.log(getCurrentPage());
console.log(getAllParams());
console.log(getQueryParam("userId"));

Environment and device information

  • getEnv() reads process.env.TARO_ENV.
  • getWindowSize() returns width, height, width-to-height ratio, and height-to-width ratio from Taro window information.
  • getSystem() returns the Taro system string.
  • isMiniProgram() and isWeapp() detect the weapp build environment.
  • isBrowser(), isWeb(), and isH5() detect the h5 build environment.
  • isPC() uses browser information when the build environment is h5.
  • isWideScreen() and isMiddleScreen() check whether the width-to-height ratio is greater than 0.7.
  • isLongScreen() checks whether the height-to-width ratio is greater than 1.9.
  • isIOS() and isAndroid() inspect the Taro system string.
import {
  getEnv,
  getSystem,
  getWindowSize,
  isH5,
  isMiniProgram,
} from "mazey-taro-utils";

console.log({
  environment: getEnv(),
  system: getSystem(),
  window: getWindowSize(),
  h5: isH5(),
  miniProgram: isMiniProgram(),
});

Navigation and interaction

  • quickNavigateTo(page, options?) calls Taro navigateTo with a route below /pages.
  • quickRedirectTo(page, options?) calls Taro redirectTo with the same route convention.
  • quickScrollTo(selector, duration?) calls Taro pageScrollTo; the default duration is 300 milliseconds.
  • quickToast(message) displays a text-only Taro toast.
  • getLoginCodeAsync() resolves with the Taro login code and rejects when the login request fails or returns no code.
import {
  getLoginCodeAsync,
  quickRedirectTo,
  quickScrollTo,
  quickToast,
} from "mazey-taro-utils";

quickToast("Loading profile");
quickRedirectTo("profile", { params: { userId: "42" } });
quickScrollTo("#profile", 500);

const code = await getLoginCodeAsync();
console.log(code);

Package outputs

  • CommonJS: lib/index.cjs.js
  • ES modules: lib/index.esm.js
  • Browser IIFE: lib/mazey-taro-utils.min.js
  • TypeScript declarations: lib/index.d.ts

The browser IIFE expects Taro and mazey globals because both runtime dependencies remain external to the package bundle.

Development

Use Node.js 22 for the repository tooling.

pnpm install
npm run typecheck
npm run lint
npm test
npm run build
npm run docs

npm run docs creates the final GitHub Pages artifact in docs/, including the homepage, React playground, TypeDoc API site, manifest, icons, service worker, robots file, and sitemap.

Run a production-like Pages preview at http://127.0.0.1:4173/mazey-taro-utils/:

npm run pwa:preview

The public playground uses controlled browser-side Taro stubs. It demonstrates the package’s generated requests without claiming to run a real mini-program environment.

License

Released under the MIT License.