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

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

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
decreased by-14.61%
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 21 Feb 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