JSPM

@katokdoescode/car-slugger

1.0.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 6
    • Score
      100M100P100Q48242F
    • License ISC

    Simple package to convert strings to slug strings. Crafted for converting car names and models to slug

    Package Exports

    • @katokdoescode/car-slugger
    • @katokdoescode/car-slugger/index.ts

    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 (@katokdoescode/car-slugger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    CAR SLUGGER PACKAGE

    Needs to convert complex string with car brand name or car model to slug. Also can convert cyrillic letters to latin.

    Usage

    # Install dependencies (only typescript needed)
    $ npm i
    
    # Generate JS if need
    $ npm run build
    
    # To see test cases try this:
    $ node ./dist/test.js

    Simple translit cyrillic to latin

    import { CarSlugger } from "car-slugger";
    const slugger = new CarSlugger();
    
    console.log(slugger.translateCyrillic('Привет мир'));
    
    // Output: "Privet mir"

    Converting to slug

    import { CarSlugger } from "car-slugger";
    const slugger = new CarSlugger();
    
    console.log(slugger.getSlug('LADA (ВАЗ) 2211 4x4'));
    
    // Output: lada-vaz-2211-4x4