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

@jsonresume/utils

v0.2.1

Published

Framework-free pure utilities for JSON Resume: date formatting, metrics, and URL safety

Readme

@jsonresume/utils

Framework-free pure utilities for JSON Resume: date formatting, derived metrics, URL safety, and resume-shape helpers.

No React, no styled-components, no side effects — safe to use anywhere: server, CLI, browser, or inside a theme.

Install

npm install @jsonresume/utils

API

Everything is re-exported from the root (.) for convenience, and also available via focused subpaths.

Root (@jsonresume/utils)

Re-exports all of the functions below, plus two resume-shape helpers:

| Function | Description | | --- | --- | | formatLocation(location) | Join city, region, countryCode into one display line (empty parts dropped). | | normalizeResume(resume) | Return a copy with all 12 standard sections present (basics as {}, arrays as []); never mutates the input. |

Dates (@jsonresume/utils/dates)

| Function | Description | | --- | --- | | formatDateRange({ startDate, endDate, format?, locale?, numberingSystem?, presentLabel? }) | Locale-aware date range via Intl.DateTimeFormat. A null endDate renders Present; a missing endDate renders a single date. | | getRelativeTime(date, ago?) | Human relative time, e.g. 6 years ago. | | getDuration(startDate, endDate?) | Duration between two dates, e.g. 2 years, 6 months (endDate defaults to now). | | normalizeDates(resume) | Shallow copy with any Date-valued date fields stringified to YYYY-MM-DD. |

Metrics (@jsonresume/utils/metrics)

| Function | Description | | --- | --- | | calculateTotalExperience(work) | Total years of professional experience (rounded to nearest year). | | calculateCurrentRoleExperience(work) | Years in the current/most-recent role (1 decimal). | | countCareerPositions(work) | Number of distinct position titles held. | | getCareerProgressionRate(work) | Average years per position. | | countTotalHighlights(work) | Total highlights across all work entries. | | countCompanies(work) | Number of unique company names. | | countProjects(projects) | Number of projects. | | countPublications(publications) | Number of publications. | | countAwards(awards) | Number of awards. | | countTotalSkills(skills) | Total skill keywords across all categories. | | countSkillCategories(skills) | Number of skill categories. | | countLanguages(languages) | Number of languages. | | calculateEducationYears(education) | Total years of education (rounded). | | getHighestDegree(education) | The highest degree by studyType ranking (e.g. PhD). | | calculateVolunteerYears(volunteer) | Total volunteer years (rounded). | | getUniqueIndustries(work) | Array of unique industry values. | | getCurrentEmployer(work) | The current (no endDate) or most-recent work entry, or null. | | isCurrentlyEmployed(work) | true if any work entry has no endDate. | | calculateKeyMetrics(resume) | Dashboard-ready array of { label, value } summarizing the resume. |

URL safety (@jsonresume/utils/url)

| Function | Description | | --- | --- | | safeUrl(url) | Block javascript:/data:/vbscript: schemes; return a safe URL or null. | | getLinkRel(url, openInNewTab?) | Return noopener noreferrer for external links opened in a new tab. | | sanitizeHtml(html) | Escape HTML-significant characters to prevent XSS. | | isExternalUrl(url, currentOrigin?) | true if the URL points to a different origin. | | formatUrlForDisplay(url) | Strip the protocol and trailing slash, e.g. example.com/blog. |

Usage

Compute headline metrics from a resume:

import {
  calculateTotalExperience,
  getHighestDegree,
  formatDateRange,
} from '@jsonresume/utils';

const years = calculateTotalExperience(resume.work);
const degree = getHighestDegree(resume.education);
const range = formatDateRange({ startDate: '2020-01-15', endDate: null });
// range === 'Jan 2020 - Present'

Import from a focused subpath to keep things tight:

import { safeUrl, getLinkRel } from '@jsonresume/utils/url';

const href = safeUrl(profile.url); // null if dangerous
const rel = getLinkRel(href, true); // 'noopener noreferrer'

Build a dashboard summary:

import { calculateKeyMetrics } from '@jsonresume/utils/metrics';

for (const { label, value } of calculateKeyMetrics(resume)) {
  console.log(`${label}: ${value}`);
}
// Years Experience: 8
// Companies: 5
// Projects: 12

Ecosystem

Part of the JSON Resume ecosystem. The styled date/link components in @jsonresume/core are built on top of these functions. See the roadmap and related packages in jsonresume/jsonresume.org#421.

License

MIT