Socket
Socket
Sign inDemoInstall

scule

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    scule

String case utils


Version published
Maintainers
1
Install size
12.8 kB
Created

Changelog

Source

1.0.0 (2022-11-14)

Features

  • better type supports (#20) (236fae0)

Readme

Source

🧵 Scule

npm version npm downloads Github Actions Codecov bundle

Install

Install using npm or yarn:

npm i scule
# or
yarn add scule

Import:

// CommonJS
const { pascalCase } = require('scule')

// ESM
import { pascalCase } from 'scule'

Notice: You may need to transpile package for legacy environments

Utils

pascalCase(str)

Splits string and joins by PascalCase convention (foo-bar => FooBar)

Remarks:

  • If an uppercase letter is followed by other uppercase letters (like FooBAR), they are preserved

camelCase

Splits string and joins by camelCase convention (foo-bar => fooBar)

kebabCase(str)

Splits string and joins by kebab-case convention (fooBar => foo-bar)

Remarks:

  • It does not preserve case

snakeCase

Splits string and joins by snake_case convention (foo-bar => foo_bar)

upperFirst(str)

Converts first character to upper case

lowerFirst(str)

Converts first character to lower case

splitByCase(str, splitters?)

  • Splits string by the splitters provided (default: ['-', '_', '/', '.])
  • Splits when case changes from lower to upper or upper to lower
  • Ignores numbers for case changes
  • Case is preserved in returned value
  • Is an irreversible function since splitters are omitted

License

MIT

FAQs

Last updated on 14 Nov 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc