DEV Community

Daniel
Daniel

Posted on

1 2

The set and get methods from lodash

What is lodash?

  • Lodash simplifies our work by providing lots of methods to handle arrays and objects.

_.get()

  • The get method gets the value from the path that’s been provided as an argument. The first argument is the object, the second is the path of the object and the third is the optional argument discussed which returns the default value
  • So, What if the path doesn’t exist or the path returns ‘undefined’. No worries Lodash allows us to pass an optional third argument which is the default value. In those situations, the default value is returned.

_.set()

  • The set method as the name suggests sets the value to the path of the object. There are three arguments. The first is the object itself, second is the path and the third one is the value.
  • So, What if the path doesn’t exist. The set() automatically creates a path for us. Here the ‘c’ path doesn’t exist but its automatically created.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more