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

set-getter

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-getter

Create nested getter properties and any intermediary dot notation (`'a.b.c'`) paths

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
671K
decreased by-7.8%
Maintainers
2
Weekly downloads
 
Created

What is set-getter?

The set-getter npm package is a utility for defining properties on an object that can be accessed and modified using dot notation. It simplifies the process of setting and getting nested properties.

What are set-getter's main functionalities?

Setting Nested Properties

This feature allows you to set a nested property on an object using a dot-notated string. The package will create any necessary intermediate objects.

const set = require('set-getter');
let obj = {};
set(obj, 'a.b.c', 'value');
console.log(obj); // { a: { b: { c: 'value' } } }

Getting Nested Properties

Although set-getter is primarily for setting properties, it works well with get-value for retrieving nested properties. This example shows how to get a nested property using a dot-notated string.

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

Other packages similar to set-getter

FAQs

Package last updated on 18 Jun 2021

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