babel-plugin-use-or-operator-for-destructuring-default-value

1.0.4 • Public • Published

Welcome to babel-plugin-use-or-operator-for-destructuring-default-value 👋

Version License: MIT

destructuring default value use ||, without undefined only

Install

yarn add babel-plugin-use-or-operator-for-destructuring-default-value

why write it

before used this babel

const user = {name: 'xiaohesong', age: null, sex: ''}
const {name, age = 18, sex = 'man'} = user
console.log(name, age, sex) // xiaohesong null

used

const user = {name: 'xiaohesong', age: null, sex: ''}
const {name, age = 18, sex = 'man'} = user
console.log(name, age, sex) // xiaohesong 18 man

Show your support

Give a ⭐️ if this project helped you!

/babel-plugin-use-or-operator-for-destructuring-default-value/

    Package Sidebar

    Install

    npm i babel-plugin-use-or-operator-for-destructuring-default-value

    Weekly Downloads

    2

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    16.3 kB

    Total Files

    3

    Last publish

    Collaborators

    • xiaohesong