gsuntres / animalcase-js

A library to convert payloads and response object from camel case to snake case and vice versa.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Archiving since there are better alternatives out there, like case-anything.

Overview

A library to convert object's keys from came case to snake case and vice versa.

Install

@animalcase-js/core can be used to manually convert keys.

npm i --save @animalcase-js/core

@animalcase-js/express a middleware for express.js

npm i --save @animalcase-js/express

Usage

const caseconvert = require('@animalcase-js/core')

const myObject = {
  propA: 1,
  propB: 2,
  myPropC: 'Hi'
}

caseconvert.convertToSnakeCase(myObject)

console.log(myObject)

should display

{
  prop_a: 1,
  prop_b: 2,
  my_prop_c: 'Hi'
}

About

A library to convert payloads and response object from camel case to snake case and vice versa.

License:MIT License


Languages

Language:TypeScript 75.9%Language:JavaScript 24.1%