stacks-objects

Provide type-safe object utilities for deep merging, mapping, picking, and clearing undefined values in Stacks projects.

622|17|Updated Apr 26, 2022
One-click install
npx skills add https://github.com/stacksjs/stacks --skill stacks-objects
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacks-objects
Source: https://github.com/stacksjs/stacks/tree/main/.claude/skills/stacks-objects
Command: npx skills add https://github.com/stacksjs/stacks --skill stacks-objects

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Working with complex data in Stacks often requires reliable, type-safe object utilities to safely merge, map, and filter object properties.

Core Features & Use Cases

  • DeepMerge: recursively merge objects with preserved types, handling nested structures and ignoring arrays for deep operations.
  • objectMap: transform or filter object entries by key/value, enabling key renaming, filtering, or value transformations.
  • objectPick: select a subset of properties from an object with optional omission of undefined values.
  • clearUndefined: mutate objects in place to remove undefined fields, keeping other falsy values intact.
  • isKeyOf / objectKeys / objectEntries: provide robust type-safe key access and inspection.

Quick Start

Install the stacks-objects utilities in your TypeScript project and run a sample deepMerge to combine two config objects.

Frequently Asked Questions about stacks-objects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deep merge objects in TypeScript while preserving nested types?

Deep merging objects in TypeScript requires recursively combining nested structures while maintaining strict typing. This utility mutates the target object, using isObject checks for mergeability and skipping deep merges for arrays to ensure type-safe results.

How do I remove undefined values from an object without clearing other falsy values?

To clear undefined values from an object while keeping other falsy values like zero or false intact, you need a targeted mutation utility. This tool mutates the object in place, strictly filtering undefined fields and preserving valid falsy data.

What is the best way to transform or filter object keys and values in TypeScript?

Transforming or filtering object keys and values in TypeScript is best handled by an object mapping utility. It enables key renaming, value transformations, and entry filtering while preserving type safety across the modified object structure.

How do I pick a subset of properties from a TypeScript object with strict typing?

Picking a subset of properties from a TypeScript object with strict typing involves selecting specific keys and optionally omitting undefined values. This utility ensures the resulting object retains accurate type information for the chosen properties.

Why does my deep merge overwrite arrays instead of merging them element by element?

Deep merge operations often intentionally skip array deep merging to prevent unpredictable data structure corruption. This utility explicitly avoids deep merging arrays, treating them as primitive values during the recursive object merge process.

Can I get type-safe object keys and entries in TypeScript without casting?

Getting type-safe object keys and entries without manual casting requires dedicated helper functions. This utility provides objectKeys and objectEntries helpers that infer and enforce strict key and value types directly from the object definition.