A collection of general purpose utilities and helpers for web projects.
npm install @smartive/utilsCleans and joins an array of class names (strings and numbers), filtering out undefined and boolean values.
import { classNames } from '@smartive/utils';
const className = classNames('btn', isActive && 'btn-active', 42, undefined, 'btn-primary');
// Result: "btn btn-active 42 btn-primary"Converts a phone number into a tel: link by removing non-digit characters (except + for international numbers).
import { getTelLink } from '@smartive/utils';
const link = getTelLink('+1 (555) 123-4567');
// Result: "tel:+15551234567"This package was previously published as @smartive/datocms-utils. With 4.0.0 it was renamed to
@smartive/utils and all DatoCMS cache tag utilities were removed.
classNamesandgetTelLinkare unchanged — only the import specifier needs to be updated.- The
cache-tagsentry points (/cache-tags,/cache-tags/neon,/cache-tags/redis,/cache-tags/noop) and theCacheTag,CacheTagsProviderandCacheTagsInvalidateWebhooktypes are gone. Stay on@smartive/datocms-utils@3if you still rely on them.
MIT © smartive AG