Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-kit

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-kit

Tree utilities which provides a full-featured extend and object-cloning facility, and various tools to deal with nested object structures.

  • 0.5.26
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
99K
decreased by-24.11%
Maintainers
1
Weekly downloads
 
Created

What is tree-kit?

The tree-kit npm package provides utilities for manipulating and traversing tree-like structures in JavaScript. It offers a variety of functions to work with nested objects and arrays, making it easier to manage hierarchical data.

What are tree-kit's main functionalities?

Deep cloning

This feature allows you to create a deep clone of an object, ensuring that nested objects are also cloned rather than referenced.

const tree = require('tree-kit');
const original = { a: 1, b: { c: 2 } };
const clone = tree.clone(original);
console.log(clone); // { a: 1, b: { c: 2 } }

Deep merging

This feature allows you to merge multiple objects deeply, combining their properties and nested structures.

const tree = require('tree-kit');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { b: { d: 3 }, e: 4 };
const merged = tree.extend(null, obj1, obj2);
console.log(merged); // { a: 1, b: { c: 2, d: 3 }, e: 4 }

Path-based access

This feature allows you to access nested properties using a dot-separated path string, making it easier to retrieve deeply nested values.

const tree = require('tree-kit');
const obj = { a: { b: { c: 42 } } };
const value = tree.get(obj, 'a.b.c');
console.log(value); // 42

Path-based setting

This feature allows you to set nested properties using a dot-separated path string, making it easier to update deeply nested values.

const tree = require('tree-kit');
const obj = { a: { b: { c: 42 } } };
tree.set(obj, 'a.b.d', 100);
console.log(obj); // { a: { b: { c: 42, d: 100 } } }

Other packages similar to tree-kit

Keywords

FAQs

Package last updated on 13 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc