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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ynmstudio/utils

v20.3.3

Published

YNM Utilities for Angular

Downloads

369

Readme

YNM Utils

A comprehensive Angular utility library providing a wide range of helpers, pipes, directives, and services to accelerate your development.

Features

Helper Functions (helpers)

Reusable utility functions for type checking, string/array/object manipulation, and more. Examples:

  • isUndefined, isNull, isNumber, isString, isArray, isObject, isFunction, isNil
  • toDecimal, upperFirst, leftPad, rightPad, pad, flatten, getProperty, sum, shuffle, deepEqual, etc.

Pipes (pipes)

  • fileSize: Formats a number of bytes as a human-readable string (e.g., 1.5 MB).
  • join: Joins array elements into a string with a custom separator.
  • joinIntl: Joins array elements using Intl.ListFormat for locale-aware lists.
  • pluck: Extracts a property from each object in an array.
  • safe: Bypasses Angular's security to safely bind HTML, style, script, URL, or resource URL.
  • focalPoint: Converts a focal point array (e.g., [0.5, 0.5]) to a CSS background-position string (e.g., 50% 50%).

Directives

  • InViewportDirective (snInViewport): Detects when an element enters or leaves the viewport. Adds sn-viewport--in/sn-viewport--out classes and emits events.
  • SmoothHeightDirective (smoothHeight): Animates height changes smoothly for dynamic content.
  • DynamicHeadingDirective (dynamicHeading): Automatically manages heading levels (h1-h6) for accessibility and semantic structure. Supports debug mode and custom hierarchy resets.
  • DrawBlurhash (drawBlurhash): Renders a BlurHash placeholder on a canvas element for progressive image loading.

Modules

  • ScrollSpyModule: Automatically updates navigation links to indicate the currently active section in the viewport. Includes directives for scroll spy, section, and item.

Services

  • LoadingBarService: Manages a global or scoped loading bar/progress indicator. Includes RxJS-based state management and HTTP interceptor for automatic progress indication.
  • YnmUtilsService: Base injectable service for general utilities.

Interceptors

  • CraftIframeResizerInterceptor: Dynamically loads iframe resizer for Craft CMS live preview in iframes.
  • CraftPreviewInterceptor: Injects preview tokens for Craft CMS live preview and prevents caching in preview mode.
  • CraftPreviewPreventIsrCacheInterceptor: Prevents ISR cache in projects for Craft CMS live
  • CraftSecurityInterceptor: Adds security headers to HTTP requests for Craft CMS APIs.
  • LoadingBarInterceptor: Integrates with Angular's HTTP client to show/hide the loading bar automatically during HTTP requests.

Signals

  • toSignalWithError: Converts an RxJS Observable to Angular Signals, exposing both value and error as signals for reactive error handling.

Installation

npm install @ynmstudio/utils

Usage

Import only the features you need. Example for a pipe:

import { FileSizePipe } from "@ynmstudio/utils/pipes/file-size";

For directives:

import { InViewportDirective } from "@ynmstudio/utils/inviewport";

For services:

import { LoadingBarService } from "@ynmstudio/utils/loading-bar";

Development

  • Build: ng build ynm-utils
  • Test: ng test ynm-utils
  • Publish: npm publish from dist/ynm-utils

License

MIT