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

ultan

v2.0.0

Published

High-performance utility suite for modern JavaScript. Optimized for AI orchestration, HealthTech (FHIR) interoperability, and secure cloud system monitoring.

Readme

Why use Ultan?

Ultan is a utility library that bridges traditional JavaScript development with modern AI, healthcare (FHIR/HL7), and cloud-native architectures. Built for Fortune 500 environments, it provides enterprise-grade functions for string manipulation, array operations, object handling, healthcare data processing, AI prompt management, PHI masking, and reactive state management. Whether you're building HIPAA-compliant healthcare applications, AI-powered workflows, or mission-critical enterprise systems, Ultan delivers production-ready utilities that eliminate boilerplate and accelerate development cycles.

Table of Contents

Installation

npm install ultan

Quick Start

const {
  stringFormat,
  isValidFhir,
  getFhirName,
  getAcuityScore,
  fillPrompt,
  parseAiJson,
  maskPHI,
  debounce,
  generateUUID
} = require('ultan');

const patient = {
  resourceType: 'Patient',
  id: '12345',
  name: [{ use: 'official', given: ['John'], family: 'Doe' }]
};

console.log(isValidFhir(patient));
console.log(getFhirName(patient));

Healthcare (FHIR/HL7)

isValidFhir(resource)

Validates if an object is a valid FHIR resource by checking for resourceType and id properties.

isValidFhir({ resourceType: 'Patient', id: '123' });

getFhirName(patient)

Extracts the official name from a FHIR Patient resource, falling back to the first name available.

const name = getFhirName(patientResource);

getAcuityScore({ hr, rr, temp, sbp })

Calculates clinical acuity score based on vital signs (heart rate, respiratory rate, temperature, systolic blood pressure).

const score = getAcuityScore({ hr: 120, rr: 26, temp: 98.6, sbp: 85 });

maskPHI(string)

Masks Protected Health Information including SSN, phone numbers, and email addresses.

const masked = maskPHI('Contact: [email protected] or 555-123-4567');

isZombie(lastHeartbeat, limit = 300000)

Detects stagnant sessions or zombie connections based on heartbeat timestamp.

const stale = isZombie('2024-01-01T10:00:00Z', 300000);

AI Integration

fillPrompt(template, variables)

Replaces {{variable}} placeholders in prompt templates with actual values.

const prompt = fillPrompt('Analyze {{dataType}} for patient {{id}}', {
  dataType: 'vitals',
  id: '12345'
});

parseAiJson(string)

Parses JSON from AI responses, handling markdown code fences and malformed output.

const data = parseAiJson('```json\n{"key": "value"}\n```');

createSignal(initialValue)

Creates a reactive signal with pub/sub pattern for state management.

const counter = createSignal(0);
counter.subscribe(val => console.log('New value:', val));
counter.set(5);
const current = counter.get();

String Manipulation

stringFormat(format, ...args)

Replaces {0}, {1}, etc. placeholders with arguments.

stringFormat('Hello, {0}! Welcome to {1}.', 'Alice', 'Ultan');

toTitleCase(string)

Converts string to title case.

toTitleCase('hello world');

sanitizeString(string)

Escapes HTML special characters.

sanitizeString('<script>alert("xss")</script>');

fromBase64(base64) / toBase64(string)

Base64 encoding and decoding with UTF-8 support.

const encoded = toBase64('Hello World');
const decoded = fromBase64(encoded);

countOccurrences(string, substring)

Counts substring occurrences.

countOccurrences('hello world hello', 'hello');

Object Utilities

isEmpty(value)

Checks if object, array, or string is empty.

isEmpty({});
isEmpty([]);
isEmpty('');
isEmpty(null);

deepClone(object)

Creates deep copy using structuredClone or JSON fallback.

const clone = deepClone({ nested: { data: [1, 2, 3] } });

setNestedProperty(object, path, value)

Sets nested property using dot notation.

const obj = {};
setNestedProperty(obj, 'user.profile.name', 'John');

getNestedProperty(object, path)

Retrieves nested property using dot notation.

const name = getNestedProperty(obj, 'user.profile.name');

objectToArray(object) / arrayToObject(array)

Converts between objects and key-value pair arrays.

objectToArray({ a: 1, b: 2 });
arrayToObject([['a', 1], ['b', 2]]);

Array Utilities

mergeArrays(array1, array2)

Merges arrays removing duplicates.

mergeArrays([1, 2, 3], [3, 4, 5]);

sumArray(array) / averageArray(array)

Calculates sum or average of numeric array.

sumArray([1, 2, 3, 4]);
averageArray([10, 20, 30]);

arrayDifference(array1, array2)

Returns elements in array1 not in array2.

arrayDifference([1, 2, 3], [2, 3, 4]);

removeFalsyValues(array)

Filters out falsy values.

removeFalsyValues([0, 1, false, 2, '', 3, null, undefined]);

groupBy(array, key)

Groups array of objects by property.

groupBy([{ type: 'A', val: 1 }, { type: 'B', val: 2 }], 'type');

Function Utilities

debounce(function, delay = 300)

Delays function execution until after delay milliseconds.

const debouncedSearch = debounce(searchFunction, 500);

throttle(function, limit)

Ensures function executes at most once per limit milliseconds.

const throttledScroll = throttle(handleScroll, 100);

HTTP/Network

reqFlow(url, options = {})

Simplified fetch wrapper that throws on non-OK responses and parses JSON.

const data = await reqFlow('https://api.example.com/data', {
  method: 'POST',
  body: JSON.stringify({ key: 'value' })
});

Miscellaneous

greet({ name, age })

Console logs greeting with optional destructured parameters.

greet({ name: 'Alice', age: 30 });
greet();

getType(value)

Returns lowercase type string.

getType([]);
getType({});
getType(null);

getRandomInRange(min, max)

Returns random float in range.

getRandomInRange(1, 10);

round(number, decimals = 2)

Rounds to specified decimal places.

round(3.14159, 2);

generateUUID()

Generates RFC4122 compliant UUID v4.

const id = generateUUID();

formatDate(date)

Formats date as MM/DD/YYYY.

formatDate(new Date());

Regular Expressions

Pre-compiled regex patterns accessible via regexes object:

  • regexes.email - Email validation
  • regexes.phone - International phone numbers
  • regexes.url - HTTP/HTTPS URLs
const { regexes } = require('ultan');
regexes.email.test('[email protected]');

Constants

DaysOfWeek

Frozen object with weekday names.

const { DaysOfWeek } = require('ultan');
console.log(DaysOfWeek.MONDAY);

HttpStatus

Common HTTP status codes.

const { HttpStatus } = require('ultan');
if (response.status === HttpStatus.NOT_FOUND) { }

License

MIT