You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

to-snake-case

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-snake-case

Convert a string to snake case.

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
267K
1.66%
Maintainers
1
Weekly downloads
 
Created

What is to-snake-case?

The 'to-snake-case' npm package is a utility that converts strings to snake_case format. This is particularly useful for formatting strings in a consistent manner, especially when dealing with identifiers in programming languages or databases that prefer snake_case.

What are to-snake-case's main functionalities?

Convert camelCase to snake_case

This feature converts a camelCase string to snake_case. For example, 'camelCaseString' becomes 'camel_case_string'.

const toSnakeCase = require('to-snake-case');
const result = toSnakeCase('camelCaseString');
console.log(result); // Outputs: camel_case_string

Convert PascalCase to snake_case

This feature converts a PascalCase string to snake_case. For example, 'PascalCaseString' becomes 'pascal_case_string'.

const toSnakeCase = require('to-snake-case');
const result = toSnakeCase('PascalCaseString');
console.log(result); // Outputs: pascal_case_string

Convert space-separated string to snake_case

This feature converts a space-separated string to snake_case. For example, 'space separated string' becomes 'space_separated_string'.

const toSnakeCase = require('to-snake-case');
const result = toSnakeCase('space separated string');
console.log(result); // Outputs: space_separated_string

Convert hyphen-separated string to snake_case

This feature converts a hyphen-separated string to snake_case. For example, 'hyphen-separated-string' becomes 'hyphen_separated_string'.

const toSnakeCase = require('to-snake-case');
const result = toSnakeCase('hyphen-separated-string');
console.log(result); // Outputs: hyphen_separated_string

Other packages similar to to-snake-case

Keywords

snake

FAQs

Package last updated on 21 Jan 2016

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