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

@khester/dynamics-utils

v1.2.1

Published

Zero-dependency utilities for Dynamics 365 development: formatting, import/export, validation, colors

Readme

@khester/dynamics-utils

Zero-dependency formatting, color, coercion, and import/export utilities for Dynamics 365 development.

What it does

A grab-bag of small, pure functions for the boring-but-load-bearing parts of Dataverse UIs: formatting values (formatCurrency, formatDate, cleanGuid, getStatusLabel), deriving colors (getContrastColor, lightenColor, getStateCodeColor, STATUS_COLORS), generating personas (getInitials, getPersonaColor), and moving data in and out via CSV/JSON (generateCSV, parseCSV, exportToFile, validateImportData). It also ships a set of Dynamics-flavored theme tokens (dynamicsSpacing, dynamicsCeColors, dynamicsShadows) and a few generic helpers (debounce, deepClone, parseQueryString, isDynamicsEnvironment). Everything is zero-dependency and runtime-agnostic, so it works in web resources, PCF controls, grid customizers, and Node alike.

When to use it

Reach for this package when you need framework-free helpers — value formatting, color math, or CSV/JSON import-export — that have no React or Fluent dependency. It is the shared foundation under @khester/dynamics-cell-renderers and @dataverse-kit/grid-kit. For rendering grids and detail lists use grid-kit; for form shells and layout containers use surface-kit; for ready-made cell display use dynamics-cell-renderers; for custom-page UI controls use reusable-components. Use dynamics-utils for the underlying primitives those components are built on.

Install

npm install @khester/dynamics-utils

No peer dependencies — this package is pure TypeScript with zero runtime dependencies.

Minimal example

import {
  formatCurrency,
  getStatusLabel,
  getStateCodeColor,
  getInitials,
  generateCSV,
  exportToFile,
} from '@khester/dynamics-utils';

// Formatting
formatCurrency(1500000);          // "$1,500,000.00"
getStatusLabel(0);                // "Active"
getStateCodeColor(1);             // hex color for an inactive record
getInitials('Ada Lovelace');      // "AL"

// Import / export
const rows = [{ name: 'Contoso', revenue: 1500000 }];
const csv = generateCSV(rows, [
  { key: 'name', name: 'Account' },
  { key: 'revenue', name: 'Revenue' },
]);

exportToFile(rows, [
  { key: 'name', name: 'Account' },
  { key: 'revenue', name: 'Revenue' },
], 'csv', 'accounts');

Key exports

| Export | Purpose | |--------|---------| | formatCurrency / formatNumber / formatDate / formatDateTime | Locale-aware value formatting with null-safe 'N/A' fallbacks | | cleanGuid / getStatusLabel | Strip {} from GUIDs; map a statecode to a label | | getContrastColor / lightenColor / darkenColor / getStateCodeColor | Color math (YIQ contrast, lighten/darken, state-driven colors) | | STATUS_COLORS / isValidHexColor / normalizeHexColor | Status color map and hex validation/normalization | | getInitials / getPersonaColor / PERSONA_COLORS | Persona initials and deterministic avatar colors | | generateCSV / generateJSON / exportToFile / downloadFile | Serialize records to CSV/JSON and trigger a download | | parseCSV / parseJSON / validateImportData / mapHeadersToColumns | Parse and validate inbound import data | | dynamicsSpacing / dynamicsCeColors / dynamicsShadows / dynamicsBorderRadius | Dynamics-flavored theme tokens | | debounce / deepClone / parseQueryString / isDynamicsEnvironment | Generic runtime helpers |