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

@hyurl/utils

v0.3.15

Published

Utility functions of HyURL collection.

Downloads

946

Readme

HyURL Utilities

Utility functions of HyURL collection.

This package currently contains the following functions, more functions may be included in the future. Each function is stored in a separated file.

Deprecated

Since v0.3.0, the following functions have been merged to @ayonli/jsext. The two packages serve different purposes, while @ayonli/jsext provides basic and semantic APIs for the JavaScript language, @hyurl/utils provides higher level functions that deal with objects.

This package still keeps a link to these functions, but they have been marked deprecated and will be removed in v0.4.0.

  • isFloat use isFloat from @ayonli/jsext/number instead.
  • isInteger use Number.isInteger instead.
  • isNumeric use isNumeric from @ayonli/jsext/number instead.
  • isBetween use isBetween from @ayonli/jsext/number instead.
  • isOwnKey use hasOwn from @ayonli/jsext/object instead.
  • isOwnMethod use hasOwnMethod from @ayonli/jsext/object instead.
  • isSubClassOf use jsext.isSubclassOf from @ayonli/jsext instead.
  • isVoid use !isValid from @ayonli/jsext/object instead.
  • omit use omit from @ayonli/jsext/object instead.
  • pick use pick from @ayonli/jsext/object instead.
  • omitVoid use omitInvalid instead.
  • rand use random from @ayonli/jsext/number instead.
  • randStr use random from @ayonli/jsext/string instead.
  • sleep use sleep from @ayonli/jsext/promise instead.
  • typeAs use as from @ayonli/jsext/object instead.
  • until use until from @ayonli/jsext/promise instead.
  • useThrottle use jsext.throttle from @ayonli/jsext instead.
  • wrap use jsext.wrap from @ayonli/jsext instead.

Import

There are many ways to import these functions.

All At Once

This method will load all functions into memory, even if you don't need some of them.

// Node.js
import * as utils from "@hyurl/utils";

// Deno
import * as utils from "https://lib.deno.dev/x/hyurl_utils@latest/index.ts";

// Browser
import * as utils from "https://lib.deno.dev/x/hyurl_utils@latest/esm/index.js";

Only Needed

This method will only load needed functions, which is recommended.

// Node.js
import count from "@hyurl/utils/count";
import ensureType from "@hyurl/utils/ensureType";

// Deno
import count from "https://lib.deno.dev/x/hyurl_utils@latest/count.ts";
import ensureType from "https://lib.deno.dev/x/hyurl_utils@latest/ensureType.ts";

// Browser
import count from "https://lib.deno.dev/x/hyurl_utils@latest/esm/count.js";
import ensureType from "https://lib.deno.dev/x/hyurl_utils@latest/esm/ensureType.js";

NOTE: Configure tsconfig.json to set compilerOptions.module as NodeNext or ESNext instead of CommonJS for this to work with Node.js+TypeScript.

Load Bundle (browser only)

<script src="https://lib.deno.dev/x/hyurl_utils@latest/bundle/index.js"></script>
<script>
    const utils = window["@hyurl/utils"];
<script>

Utilities Types

Other than utility functions, this package also provides some utility types for TypeScript, they are located in the following file and exposed to the global namespace.

import "@hyurl/utils/types";