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

@amritk/helpers

v0.4.0

Published

Shared utilities for the mjst code generation ecosystem.

Downloads

659

Readme

@amritk/helpers

Shared schema-traversal and runtime helpers for the mjst code generation ecosystem.

status  version  license  JSON Schema  node  vibe coded


Overview

@amritk/helpers is the shared utility belt used by mjst's generators and by the runtime code those generators produce. Each helper is published as its own subpath export so consumers (and generated output) only pull in what they need — no barrel, no incidental dependencies.


Installation

npm install @amritk/helpers
# or
pnpm add @amritk/helpers
# or
yarn add @amritk/helpers
# or
bun add @amritk/helpers

Modules

Schema traversal

| Subpath | Exports | Purpose | |:---|:---|:---| | @amritk/helpers/extract-refs | extractRefs | Collect every $ref reachable from a schema. | | @amritk/helpers/resolve-ref | resolveRef | Resolve a JSON pointer $ref against a root schema. | | @amritk/helpers/build-dynamic-ref-map | buildDynamicRefMap | Build a map of $dynamicAnchor → resolved location. | | @amritk/helpers/resolve-dynamic-refs | resolveDynamicRefs | Replace $dynamicRef occurrences using the map above. | | @amritk/helpers/upgrade-draft07-schema | upgradeDraft07Schema, isDraft07Schema | Upgrade a Draft-07 schema to 2020-12. | | @amritk/helpers/ref-to-filename | refToFilename, toKebabCase | Convert a $ref to a stable filename. | | @amritk/helpers/ref-to-name | refToName | Convert a $ref to a TypeScript identifier (PascalCase). | | @amritk/helpers/schema-guards | isSchemaObject, hasType, hasProperties, hasOneOf, hasAnyOf, hasAllOf, hasEnum, hasConst, hasPattern, hasFormat, hasDefault, hasExamples, hasRequired, hasItems, hasAdditionalProperties, hasMinLength, hasMaxLength, hasMinimum, hasMaximum, hasExclusiveMinimum, hasExclusiveMaximum, hasMultipleOf, hasMinItems, hasMaxItems, hasUniqueItems, hasMinProperties, hasMaxProperties, … | Type-narrowing predicates for JSON Schema keywords. |

Codegen utilities

| Subpath | Exports | Purpose | |:---|:---|:---| | @amritk/helpers/generate-type-definition | generateTypeDefinition | Render a TypeScript type from a schema node. | | @amritk/helpers/parse-documentation | parseDocumentation, ObjectDocumentation | Parse a markdown doc file into per-property descriptions. |

Runtime helpers (also copied into generated output)

| Subpath | Exports | Purpose | |:---|:---|:---| | @amritk/helpers/is-object | isObject | Narrow unknownRecord<string, unknown>. | | @amritk/helpers/safe-accessor | safeAccessor | Read a key from an unknown value without throwing. | | @amritk/helpers/validate-array | validateArray | Validate array shape and items. | | @amritk/helpers/validate-record | validateRecord | Validate record shape and additional properties. |


Usage

import { resolveRef } from '@amritk/helpers/resolve-ref'
import { isObjectSchema, hasProperties } from '@amritk/helpers/schema-guards'

const node = resolveRef('#/$defs/info', rootSchema)

if (isObjectSchema(node) && hasProperties(node)) {
  for (const [name, property] of Object.entries(node.properties)) {
    // ...
  }
}

Each helper has its own colocated test file (*.test.ts) — read those for canonical examples.


Related packages


License

MIT