Ninja Pumpkin Mutants

    casing
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    casing

    Recursively transform object key strings to and from camelCase and snake_case.

    • Supports objects, arrays and a combination of both in any depth.
    • Was originally intended for use with BookShelf and Knex.

    Installation

    $ npm install casing

    Usage

    'use strict';
    var casing = require('casing');
     
    var wasCamel = {
      objId: 123,
      myName: 'Slim Shady'
    };
    console.log(casing.snakeize(wasCamel));
    // => { obj_id: 123, my_name: 'Slim Shady' }
     
    var was_snake = {
      obj_id: 456,
      my_name: 'fiddycent'
    };
    console.log(casing.camelize(was_snake));
    // => { objId: 456, myName: 'fiddycent' }

    TypeScript

    This package includes a definition file for TypeScript.

    import { camelize, snakeize } from 'casing';
     
    var wasCamel = { objId: 123 };
    snakeize(wasCamel);
     
    var was_snake = { obj_id: 456 };
    camelize(was_snake);

    License

    MIT

    Install

    npm i casing

    DownloadsWeekly Downloads

    408

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    3.6 kB

    Total Files

    7

    Last publish

    Collaborators

    • buster