JSPM

@itreg/string-toolkit

1.1.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 6
    • Score
      100M100P100Q43359F
    • License MIT

    Simple string manipulation utilities

    Package Exports

    • @itreg/string-toolkit
    • @itreg/string-toolkit/src/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@itreg/string-toolkit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @itreg/string-toolkit

    A lightweight JavaScript utility library for simple and consistent string case transformations. Supports conversion to snake_case and kebab-case.


    Installation

    npm

    npm install @itreg/string-toolkit

    yarn

    yarn add @itreg/string-toolkit

    Usage

    const { toSnakeCase, toKebabCase } = require("@itreg/string-toolkit");

    API

    toSnakeCase(string)

    Converts a string into snake_case (lowercase words separated by underscores).

    Example:

    toSnakeCase("Hello World");
    // "hello_world"

    Behavior:

    • Trims leading/trailing whitespace
    • Converts all characters to lowercase
    • Replaces spaces and hyphens with underscores
    • Removes unsupported special characters

    toKebabCase(string)

    Converts a string into kebab-case (lowercase words separated by dashes).

    Example:

    toKebabCase("Hello World");
    // "hello-world"

    Behavior:

    • Trims leading/trailing whitespace
    • Converts all characters to lowercase
    • Replaces spaces and underscores with dashes
    • Removes unsupported special characters

    Development

    Install dependencies

    npm install

    Run tests

    npm test

    Testing

    This project uses Jest for unit testing.

    Example tests:

    const { toSnakeCase, toKebabCase } = require("../src");
    
    test("converts string to snake_case", () => {
      expect(toSnakeCase("Hello World")).toBe("hello_world");
    });
    
    test("converts string to kebab-case", () => {
      expect(toKebabCase("Hello World")).toBe("hello-world");
    });

    Project Structure

    string-toolkit/
    ├── src/
    ├── tests/
    ├── package.json
    ├── README.md

    Contributing

    Contributions are welcome.

    Basic workflow:

    1. Fork the repository
    2. Create a feature branch (git checkout -b feature/your-feature)
    3. Commit your changes
    4. Push to your fork
    5. Open a Pull Request

    Please follow the templates provided in the repository for issues and pull requests.


    Security

    If you discover a vulnerability, please report it according to the instructions in SECURITY.md.


    License

    This project is licensed under the MIT License. See LICENSE.md for details.