analytics-utils is a lightweight utility library providing common data manipulation functions specifically designed to support the 'analytics' module ecosystem. Currently at version 1.1.1, this package does not follow a strict time-based release cadence but typically releases new versions in conjunction with updates or new features in the primary 'analytics' library. Its key differentiators include a focused API tailored for analytics payload processing, often leveraging immutable data patterns, and first-class TypeScript support. It is not intended as a general-purpose utility library like Lodash or Ramda, but rather as a specialized toolkit for tasks such as deep property access, data cleaning, and transformation within an analytics context.
npm install analytics-utilsVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing and using common `analytics-utils` functions like `get`, `set`, and `isPlainObject` for manipulating analytics event data, showcasing deep property access, immutable updates, and type checking.
Always capture the return value of functions like `set`: `const newObject = set(originalObject, 'path', value);`
Update your imports to use named exports: `import { utilityName } from 'analytics-utils';`. Review the specific utility function names as some might have been renamed for consistency.Use nullish coalescing or optional chaining where appropriate: `const value = get(obj, 'path') ?? 'defaultValue';` or `const value = get(obj, 'path')?.someProp;`
Migrate any direct `analytics` module utility calls to explicit imports from `analytics-utils`: `import { utility } from 'analytics-utils';`Ensure you are using named imports for individual utilities: `import { get } from 'analytics-utils';`Consult the `analytics-utils` documentation or source code to verify the exact name of the utility function you intend to use. Most utilities are named exports.