New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ts-object-formatter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-object-formatter

A tiny library for formatting object fields in snake case or camel case.

latest
npmnpm
Version
1.0.3
Version published
Weekly downloads
93
2225%
Maintainers
1
Weekly downloads
 
Created
Source

ts-object-formatter · license

A tiny library for formatting object fields in snake case or camel case.

Installation

To install ts-object-formatter, execute:

npm install ts-object-formatter

Quickstart

Below is an example of how to use the library:

import objectFormatter from 'ts-object-formatter';

const map = {
  user_nickname: 'evandrolg',
  last_post: '2023-01-01',
  career: {
    last_companies: ['spotify', 'dazn', 'joyn'],
  },
};

objectFormatter(map, 'lowerCamelCase');
/*
{
  userNickname: 'evandrolg',
  lastPost: '2023-01-01',
  career: {
    lastCompanies: ['spotify', 'dazn', 'joyn'],
  },
}
*/

API

objectFormatter(object, filter)

Converts the object keys to camel or snake case.

object

Type: object
Object that will be formatted.

filter

Type: lowerCamelCase | upperCamelCase | lowerSnakeCase | upperSnakeCase
Filter that will be applied to convert the object key.

Keywords

object

FAQs

Package last updated on 01 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts