Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

util-string-case

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

util-string-case

string case testing and conversion: mixed snake case, screaming snake case, screaming dash case, screaming dot case, screaming slash case, snake case, dash case, dot case, slash case, camel case

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

util-string-wrap

experimental

Small utility library implementing string case testing and conversion: mixed snake case, screaming snake case, screaming dash case, screaming dot case, screaming slash case, screaming space case, snake case, dash case, dot case, slash case, space case, space caps case, camel case.

Case tests are done by pre-analyzing string content to make multiple tests for various case styles efficient.

Case Names:

  • camelCase
  • PascalCase
  • snake_case
  • Mixed_Snake_Case
  • SCREAMING_SNAKE_CASE
  • dot.case
  • Mixed.Dot.Case
  • SCREAMING.DOT.CASE
  • dash-case
  • Mixed-Dash-Case
  • SCREAMING-DASH-CASE
  • slash/case
  • Mixed/Slash/Case
  • SCREAMING/SLASH/CASE
  • space case
  • Mixed Space Case
  • SCREAMING SPACE CASE

defines StringCase class which takes a string as construction argument and provides on the instance:

  • Test original string for being of given case

    • .isMixedCamelCase()
    • .isMixedSnakeCase()
    • .isMixedDashCase()
    • .isMixedDotCase()
    • .isMixedSlashCase()
    • .isMixedSpaceCase()
    • .isScreamingSnakeCase()
    • .isScreamingDashCase()
    • .isScreamingDotCase()
    • .isScreamingSlashCase()
    • .isScreamingSpaceCase()
    • .isSnakeCase()
    • .isDashCase()
    • .isDotCase()
    • .isSlashCase()
    • .isSpaceCase()
    • .isCapitalizedSpaceCase()
    • .hasNoUpperCase()
    • .hasNoLowerCase()
    • .hasUpperCase()
    • .hasLowerCase()
    • .hasLowerCaseOrUpperCase()
    • .isLowerCase()
    • .isUpperCase()
    • .isCamelCase()
    • .isPascalCase()
  • Test if can convert original string to given case

    • .canBeMixedSnakeCase()
    • .canBeScreamingSnakeCase()
    • .canBeSnakeCase()
    • .canBeMixedDashCase()
    • .canBeScreamingDashCase()
    • .canBeDashCase()
    • .canBeMixedDotCase()
    • .canBeScreamingDotCase()
    • .canBeDotCase()
    • .canBeMixedSlashCase()
    • .canBeScreamingSlashCase()
    • .canBeSlashCase()
    • .canBeMixedSpaceCase()
    • .canBeScreamingSpaceCase()
    • .canBeSpaceCase()
    • .canBeCapitalizedSpaceCase()
    • .canBeCamelCase()
    • .canBeProperCamelCase()
    • .canBePascalCase()
  • Convert original string to given case

    • Add separator where case changes from uppercase to lowercase or where separator exists
      • .makeMixedSnakeCase()
      • .makeMixedDotCase()
      • .makeMixedDashCase()
      • .makeMixedSlashCase()
      • .makeMixedSpaceCase()
    • Add separators as above and capitalize each span
      • .makeProperSnakeCase()
      • .makeProperDotCase()
      • .makeProperDashCase()
      • .makeProperSlashCase()
      • .makeProperSpaceCase()
    • .makeCamelCase()
    • .makeProperCamelCase()
    • .makePascalCase()
    • .makeScreamingSnakeCase()
    • .makeSnakeCase()
    • .makeScreamingDashCase()
    • .makeDashCase()
    • .makeScreamingDotCase()
    • .makeDotCase()
    • .makeScreamingSlashCase()
    • .makeSlashCase()
    • .makeSpaceCase()
    • .makeScreamingSpaceCase()
    • .makeCapitalizedSpaceCase()

Install

Use npm to install.

npm install util-string-case --save

Usage

NPM

License

MIT, see LICENSE.md for details.

Keywords

FAQs

Package last updated on 05 Apr 2020

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc