defu

🌊 Assign default properties recursively

MIT License

Downloads
26.6M
Stars
1K
Committers
12

Bot releases are hidden (Show)

defu - v6.1.4 Latest Release

Published by pi0 10 months ago

compare changes

🩹 Fixes

  • Merge objects with Module type (#121)

💅 Refactors

  • Move isPlainObject to _utils to allow testing (e922a16)
  • Make isPlainObject logic more readable (e458b63)

📖 Documentation

✅ Tests

  • Improve tests for internal isPlainObject util (b24a213)

❤️ Contributors

defu - v6.1.3

Published by pi0 12 months ago

compare changes

🩹 Fixes

  • Only merge plain objects (#111)

📦 Build

  • Backward compatible cjs entry (#110)

📖 Documentation

  • Update badges (581dd92)
  • Fix typo (#96)
  • Fix the result of the array merging (#99)
  • Fix typo (#107)

❤️ Contributors

defu -

Published by pi0 over 2 years ago

⚠ BREAKING CHANGES

  • When merging arrays, defaults are last in order:
defu(['a', 'b'], ['c', 'd'])

// With v6+
['a', 'b', 'c', 'd']

// Before
['c', 'd', 'a', 'b']
  • Using named exports instead of the default export

Before:

// With v6+
import { defu } from 'defu'
const { defu } = require('defu')

// Before
import defu from 'defu'
const defu = require('defu')

Other utilities are also exported as named exports to be tree-shakable:

// instead of defu.fn
import { defuFn } from 'defu'

// Instead of defu.arrayFn
import { defuArrayFn } from 'defu'

// Instead of defu.extend
import { createDefu } from 'defu'

Features

  • concat array defaults to the last (f6df314)
  • use named exports (4a8fc52)
defu -

Published by pi0 over 3 years ago

⚠ BREAKING CHANGES

  • undefined values will be bypassed and not consistent behavior with defaults-deep anymore.

Features

defu -

Published by pi0 over 3 years ago

⚠ BREAKING CHANGES

  • module exports

Features

defu -

Published by pi0 almost 4 years ago

Bug Fixes

  • switch back to bili for es5 support till fixing in siroc (07786c2)
defu -

Published by pi0 almost 4 years ago

Bug Fixes

  • types: correct type inference where merged types are same (#26) (f322607)
defu -

Published by pi0 almost 4 years ago

Features

  • add type inference for defu result (#24) (934d736)
  • pass namespace to custom merger (#25) (6bd7ef5)
defu - v3.1.0

Published by Atinux about 4 years ago

Features