Socket
Socket
Sign inDemoInstall

dottie

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dottie

Object traversing/manipulation util


Version published
Weekly downloads
2M
decreased by-11.34%
Maintainers
1
Weekly downloads
 
Created

What is dottie?

The dottie npm package is a utility for safely reading and writing deep properties of objects in JavaScript. It uses dot notation strings to access deeply nested properties and provides a set of functions to manipulate these properties without worrying about whether the intermediate properties exist.

What are dottie's main functionalities?

Get

Retrieve the value of a nested property using a dot notation string.

const dottie = require('dottie');
const value = dottie.get({a: {b: {c: 'd'}}}, 'a.b.c'); // 'd'

Set

Set the value of a nested property using a dot notation string. If intermediate properties do not exist, they are created.

const dottie = require('dottie');
const obj = {};
dottie.set(obj, 'a.b.c', 'd'); // obj is now {a: {b: {c: 'd'}}}

Transform

Transform an object with dot notation string keys into a nested object structure.

const dottie = require('dottie');
const obj = { 'a.b.c': 'd' };
const transformed = dottie.transform(obj); // transformed is now {a: {b: {c: 'd'}}}

Exists

Check if a nested property exists within an object using a dot notation string.

const dottie = require('dottie');
const exists = dottie.exists({a: {b: {c: 'd'}}}, 'a.b.c'); // true

Paths

Get an array of dot notation paths for all properties in an object.

const dottie = require('dottie');
const paths = dottie.paths({a: {b: {c: 'd'}}}); // ['a.b.c']

Other packages similar to dottie

FAQs

Package last updated on 28 Mar 2014

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