package capitalization

  1. Overview
  2. Docs
Defines case conventions and functions to rename identifiers according to them

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=f71d45ec929c9fc9b08e07723c15b6663b0143c4465b5d93038f653258cd5c6f

Description

Published: 23 May 2024

README

"Capitalization: naming conventions for multiple-word identifiers"

This library provides helper functions for formatting words using common naming conventions, such as snake_case, camelCase, and PascalCase.

Example

# open Core

# print_endline "\n";
  let identifier_words = [ "foo"; "bar"; "baz" ] in
  List.iter Capitalization.all ~f:(fun capitalization ->
    let identifier = Capitalization.apply_to_words capitalization identifier_words in
    let capitalization_string = Capitalization.to_string capitalization in
    print_endline [%string "%{identifier} (%{capitalization_string})"]);
  print_endline ""

FooBarBaz (PascalCase)
fooBarBaz (camelCase)
foo_bar_baz (snake_case)
Foo_bar_baz (Capitalized_snake_case)
Foo_Bar_Baz (Pascal_Snake_Case)
FOO_BAR_BAZ (SCREAMING_SNAKE_CASE)
fOo_bAr_bAz (aLtErNaTiNg_sNaKe_cAsE)
foo-bar-baz (kebab-case)
Foo-bar-baz (Capitalized-kebab-case)
Foo-Bar-Baz (Pascal-Kebab-Case)
FOO-BAR-BAZ (SCREAMING-KEBAB-CASE)
fOo-bAr-bAz (aLtErNaTiNg-kEbAb-cAsE)
Foo bar baz (Sentence case)
Foo Bar Baz (Title Case)
foo bar baz (lower sentence case)
FOO BAR BAZ (UPPER SENTENCE CASE)
fOo bAr bAz (aLtErNaTiNg sEnTeNcE CaSe)

- : unit = ()

Dependencies (4)

  1. dune >= "3.11.0"
  2. ppx_base >= "v0.17" & < "v0.18"
  3. base >= "v0.17" & < "v0.18"
  4. ocaml >= "5.1.0"

Dev Dependencies

None

Used by (1)

  1. ppx_string_conv

Conflicts

None

OCaml

Innovation. Community. Security.