@mfederczuk/deeptools

A set of utility functions that recursively operate on objects


Keywords
deep, copy, freeze, deepclone, deepcopy, deepequal, deepequals, deepfreeze, deeptools, javascript, javascript-library, js, ts, typescript, typescript-library
License
CNRI-Python-GPL-Compatible
Install
npm install @mfederczuk/deeptools@1.0.4

Documentation

DeepTools

version: 1.0.4 Changelog

About

DeepTools is a set of utility functions that recursively operate on objects.

Download

Using npm:

npm i @mfederczuk/deeptools

Using Yarn:

yarn add @mfederczuk/deeptools

Usage

deepCopy

function deepCopy<T>(obj: T): T;

Creates a deep copy of obj.

deepEquals

function deepEquals(obj1: unknown, obj2: unknown): boolean;

Checks if obj1 and obj2 are equal by recursing through their properties.

deepFreeze

function deepFreeze<T>(arr: T[][]): readonly (readonly Readonly<T>[])[];

Recursively freezes arr, all of arr's items and all items of arr's items.

function deepFreeze<T>(arr: T[]): readonly Readonly<T>[];

Recursively freezes arr and all of its items.

function deepFreeze<T>(obj: T): Readonly<T>;

Recursively freezes obj and all of its properties.

safeCopy

function safeCopy<T>(arr: T[][]): readonly (readonly Readonly<T>[])[];
function safeCopy<T>(arr: T[]): readonly Readonly<T>[];

Creates a safe copy of arr by creating a deep frozen copy of it.

function safeCopy<T>(obj: T): Readonly<T>;

Creates a safe copy of obj by creating a deep frozen copy of it.

Contributing

Read through the DeepTools Contribution Guidelines if you want to contribute to this project.

License

GNU GPLv3+