Narcissistic Preening Monarch

    @sadorlovsky/rename-props
    TypeScript icon, indicating that this package has built-in type declarations

    5.0.1 • Public • Published

    rename-props build codecov

    rename object properties

    Install

    $ yarn add @sadorlovsky/rename-props

    Usage

    import { renameProps } from '@sadorlovsky/rename-props'
     
    const obj = { a: 1, b: 2 }
    const renamed = renameProps(obj, { a: 'x', b: 'y' })
     
    console.log(renamed) // { x: 1, y: 2 }
     

    FP style:

    import { map, curryRight } from 'lodash/fp'
    import { renameProps } from '@sadorlovsky/rename-props'
     
    const list = [{ a: 1, b: 2 }, { a: 3, b: 4 }]
    const curried = curryRight(renameProps)
    const rename = map(curried({ a: 'x', b: 'y' }))
    const renamed = rename(list)
     
    console.log(renamed) // [{ x: 1, y: 2 }, { x: 3, y: 4 }]

    Keywords

    none

    Install

    npm i @sadorlovsky/rename-props

    DownloadsWeekly Downloads

    4

    Version

    5.0.1

    License

    MIT

    Unpacked Size

    5.56 kB

    Total Files

    5

    Last publish

    Collaborators

    • sadorlovsky