Skip to content
forked from unjs/defu

🇩 Recursively assign default properties. Lightweight and Fast!

License

Notifications You must be signed in to change notification settings

insdevmail/defu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🇩 defu

Recursively assign default properties. Lightweight and Fast!

Standard JS david dm codecov circleci

npm version npm downloads package phobia bundle phobia

Install

Install package:

npm install defu

OR

yarn add defu

Usage

const options = defu (object, defaults)

Arguments

  • object (Object): The destination object.
  • source (Object): The source object.
const defu = require('defu')

console.log(defu({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }))
// => { a: { b: 2, c: 3 } }

Remarks

  • object and defaults are not modified

  • Assignment of __proto__ and constructor keys will be skipped to prevent security issues with object pollution.

License

MIT. Made with 💖

About

🇩 Recursively assign default properties. Lightweight and Fast!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%