Nasal Pathway Melodrama

    object-keys-mapping
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/object-keys-mapping package

    3.0.0 • Public • Published

    NPM version Build status Test coverage License Dependency status

    object-keys-mapping

    APIs

    • Operator

      • .map()
    • reverseCamelcase()

    • toCamelcase()

    • trim()

    Usage

    import { Operator } from 'object-keys-mapping'
     
    const operator = new Operator({
      camelcase: true,
      mapping: {
        '.title': '.name',
        '.info.nick': 'nickname',
        '.items.title': 'name'
      }
    })
     
    const obj = operator.map({
      user_id: 123,
      title: 'hi',
      info: {
        nick: 'cat'
      },
      items: [{
        title: 'dog'
      }]
    })
     
    // obj is:
     
    {
      userId: 123,
      name: 'hi',
      info: {
        nickname: 'cat'
      },
      items: [{
        name: 'dog'
      }]
    }
    toCamelcase({
      user_name: 'hi',
      age: 8
    })
    reverseCamelcase({
      userName: 'hi',
      age: 8
    })

    License

    MIT

    Install

    npm i object-keys-mapping

    DownloadsWeekly Downloads

    6

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    13.6 kB

    Total Files

    10

    Last publish

    Collaborators

    • coderhaoxin