mongez-reinforcements-mixed

Clone, compare, shuffle, and coalesce complex data structures with circular reference support.

3|2|Updated Dec 20, 2021
One-click install
npx skills add https://github.com/hassanzohdy/reinforcements --skill mongez-reinforcements-mixed
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mongez-reinforcements-mixed
Source: https://github.com/hassanzohdy/reinforcements/tree/main/skills/mixed
Command: npx skills add https://github.com/hassanzohdy/reinforcements --skill mongez-reinforcements-mixed

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Deep cloning, deep equality checks, a robust shuffle, and a safe coalesce utility across complex data structures, reducing the need for multiple small libraries.

Core Features & Use Cases

  • Deep clone: handles Date, RegExp, Error objects, Map/Set, arrays, TypedArrays, and circular references using WeakMap.
  • Deep equality: performs non-mutating comparisons for nested objects, including circular references.
  • Shuffle: Fisher–Yates shuffle for arrays with optional in-place mutation.
  • Coalesce: returns the first defined and non-nullish value among inputs.

Quick Start

Import clone, areEqual, shuffle, and coalesce from @mongez/reinforcements and start using them in your data workflows.

Frequently Asked Questions about mongez-reinforcements-mixed

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

FAQPage Schema
How do I deep clone an object with circular references in JavaScript?

Deep clone objects with circular references by using a WeakMap to track visited nodes, ensuring complex structures like Map, Set, Date, and TypedArrays are safely duplicated without infinite loops.

What is the best way to check deep equality on nested objects containing circular references?

Check deep equality on nested objects with circular references using a non-mutating comparison algorithm that safely tracks visited paths to prevent infinite recursion during structural validation.

How do I safely shuffle an array using the Fisher-Yates algorithm in TypeScript?

Safely shuffle arrays using the Fisher-Yates algorithm in TypeScript by providing an optional in-place mutation flag, ensuring a statistically random distribution of elements with strict type support.

How does a coalesce utility handle nullish values in JavaScript data transformation?

A coalesce utility handles nullish values in data transformation by returning the first defined, non-nullish value among its inputs, providing a safe fallback mechanism for optional properties.

Do I need external runtime dependencies to perform deep cloning and deep equality checks?

You do not need external runtime dependencies to perform deep cloning and deep equality checks, as these utilities operate with zero dependencies while handling complex object graphs and non-plain classes.