<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv" -->

---
title: Say Goodbye to Spread Operator: Use Default Composer
description: &quot; default-composer&quot; is a lightweight JavaScript library that allows you to set default values for nested objects. The library replaces empty...
canonical: https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Say Goodbye to Spread Operator: Use Default Composer | daily.dev
og:description: &quot; default-composer&quot; is a lightweight JavaScript library that allows you to set default values for nested objects. The library replaces empty...
og:url: https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv
og:image: https://api.daily.dev/og/posts/FA7YtN0iV.png
og:image:alt: Say Goodbye to Spread Operator: Use Default Composer
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Say Goodbye to Spread Operator: Use Default Composer

**[Community Picks](https://daily.dev/sources/community)** · 4 min read · 174 upvotes · 41 comments

## Summary

" default-composer" is a lightweight JavaScript library that allows you to set default values for nested objects. The library replaces empty strings/arrays/objects, null, or undefined values in an existing object with the defined default values. This helps simplify programming logic and reduce the amount of code needed to set the default values.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://dev.to/aralroca/say-goodbye-to-spread-operator-use-default-composer-3c2j>

## Community discussion

Top comments from developers on daily.dev.

**@ivancho** · 57 upvotes

> Interesting, but I'm more in the side of not adding a lot of dependencies for something that is not to heavy logic.

**@cervarlcg** · 13 upvotes

> i have a better joke: npm i is-odd

**@m4n50n** · 10 upvotes

> Nop

**@pangolin95** · 9 upvotes

> Easiness of read will always be something subjective and not something that will make me add another dependency into my project

**@kyoukhana** · 5 upvotes

> Need somebody to read this article.  Need more opinions to chime in on this.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Say Goodbye to Spread Operator: Use Default Composer","url":"https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv"},"datePublished":"2023-06-07T12:27:14.978Z","dateModified":"2023-12-07T12:02:45.284Z","description":"\" default-composer\" is a lightweight JavaScript library that allows you to set default values for nested objects. The library replaces empty...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/877af5b3ec27ed68cdebf3dc6406a0aa?_a=AQADKdt","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/877af5b3ec27ed68cdebf3dc6406a0aa?_a=AQADKdt","isAccessibleForFree":true,"articleSection":"Community Picks","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Community Picks","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1655817725/logos/community","url":"https://daily.dev/sources/community"},"commentCount":41,"discussionUrl":"https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":174},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":41}],"keywords":"javascript","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Community Picks","item":"https://daily.dev/sources/community"},{"@type":"ListItem","position":3,"name":"Say Goodbye to Spread Operator: Use Default Composer"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/say-goodbye-to-spread-operator-use-default-composer-fa7ytn0iv","comment":[{"@type":"Comment","text":"Interesting, but I’m more in the side of not adding a lot of dependencies for something that is not to heavy logic.","datePublished":"2023-06-08T13:47:26.988Z","dateModified":"2023-06-08T13:47:41.858Z","url":"https://daily.dev/posts/FA7YtN0iV#c-cMMsVZws2","author":{"@type":"Person","name":"Ivan Rivera","url":"https://daily.dev/ivancho","image":"https://lh3.googleusercontent.com/a/AEdFTp6BZ2sWxq7mA7tdfwDk_njZcdcOA88yeYffxls1bWo=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":57}},{"@type":"Comment","text":"i have a better joke: npm i is-odd","datePublished":"2023-06-08T14:43:00.723Z","url":"https://daily.dev/posts/FA7YtN0iV#c-ZdkTqP3O7","author":{"@type":"Person","name":"Jesus Cervantes","url":"https://daily.dev/cervarlcg","image":"https://avatars.githubusercontent.com/u/53922412?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":13}},{"@type":"Comment","text":"Nop","datePublished":"2023-06-08T13:51:38.715Z","url":"https://daily.dev/posts/FA7YtN0iV#c-2jTHhGW1K","author":{"@type":"Person","name":"Jose Clemente García Rodríguez","url":"https://daily.dev/m4n50n","image":"https://avatars.githubusercontent.com/u/92524023?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":10}},{"@type":"Comment","text":"Easiness of read will always be something subjective and not something that will make me add another dependency into my project","datePublished":"2023-06-08T14:18:38.821Z","url":"https://daily.dev/posts/FA7YtN0iV#c-UqHxPBpkD","author":{"@type":"Person","name":"sandro","url":"https://daily.dev/pangolin95","image":"https://lh3.googleusercontent.com/a/AAcHTtdw4Bot_8HZQT7Alav4XTVoUTfFRQjnb8pFefqT=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":9}},{"@type":"Comment","text":"Need somebody to read this article.  Need more opinions to chime in on this.","datePublished":"2023-06-07T17:30:09.292Z","url":"https://daily.dev/posts/FA7YtN0iV#c-QGbz0E8CM","author":{"@type":"Person","name":"Kevin","url":"https://daily.dev/kyoukhana","image":"https://avatars2.githubusercontent.com/u/756849?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5}}]}
```

