Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

10 Commits

Repository files navigation

This is a simple JavaScript function which allows you to get and set deeply nested values from objects.

npm install deepnested

Usage

importnestedfrom'deepnested';

Now that nested has been imported in to your project you're able to start getting and settings deeply nested object values

Get Values

varteam={tom: {name: 'Tom',age: 26,position: 'Developer',team: {title: 'Product Page',members: ['nick','tom','nicole'],employed: true}},nicole: {name: 'Nicole',age: 21,position: 'Tester'},nick: {name: 'Nick',age: 400,position: 'Colour-inner'}};varteamTitle=nested(team).get(['tom','team','title']);// Product Page

Set Values

You can use nested to overwrite values in your object

nested(team).set(['tom','team','employed'],false);varemployed=nested(team).get(['tom','team','employed']);// Now equal to false

About

Safely access deeply nested objects

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages