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

@timmons-group/snack-utils

v0.1.1

Published

SNACK is a collection of components that can be used to build a shared node architecture. The utils module contains a collection of utilities that can be used to build a serveless node application.

Downloads

306

Readme

Shared Node Architecture Component Kit (SNACK) Utils

SNACK is a collection of components that can be used to build a shared node architecture. The utils module contains a collection of utilities that can be used to build a serveless node application.

Roadmap

  • [x] Collect Shared Utilities
  • [x] Refactor
  • [x] Add Documentation
  • [ ] Publish v1

Utilities

Logger

The logger utility is a simple utility that can be used to log messages to the console. It supports different log levels and can be configured to log to different destinations.t

By default, the logger supresses all log messages. To enable logging, set the LOG_LEVEL environment variable to one of the following values:

  • INFO - Logs info, warnings, and errors
  • WARN - Logs warnings and errors
  • ERROR - Default

To log a message, first create the logger instance:

import { createLoggers } from '@timmons-group/snack-utils';
const { log, warn, error } = createLoggers('MyModule');

Then use the logger to log messages:

log('This is an info message');
warn('This is a warning message');
error('This is an error message');

You can programatically set the log level by calling the setLogLevel function:

import { setLogLevel } from '@timmons-group/snack-utils';
setLogLevel('INFO');

Profiler

The profiler utility is a simple utility that can be used to profile the performance. Using a set of labels and timestamps, the profiler can be used to measure the time it takes to execute a block of code.

To use the profiler, first create an instance of the profiler:

import { createProfiler } from '@timmons-group/snack-utils';
const profiler = createProfiler();

Then use the profiler to profile a block of code:

profiler.tab('Block 1');
// Code to profile
profiler.tab('Block 2');
// Code to profile
profiler.tab('Block 3');
// Code to profile
profiler.end();
profiler.report();

The profiler will output the time it took to execute each block of code.

Responses

The responses utility is a simple utility that can be used to generate HTTP responses for use with lambda. It supports different response types and can be used to generate responses for different status codes.

Supported response types:

  • jsonSuccess - Generates a successful (200) JSON response and sets the Content-Type header to application/json
  • noContent - Generates a successful (204) response with no content
  • notFound - Generates a not found (404) response
  • badRequest - Generates a bad request (400) response
  • unauthorized - Generates an unauthorized (401) response
  • serverError - Generates a server error (500) response

To use the responses utility, first import the utility:

import { responses } from '@timmons-group/snack-utils';

Then use the utility to generate responses:

const response = responses.jsonSuccess({ message: 'Hello, World!' });

Alternatively, you can import the individual response types:

import { jsonSuccess } from '@timmons-group/snack-utils/responses';
const response = jsonSuccess({ message: 'Hello, World!' });