slug


https://github.com/Aurel300/hx-slug

To install, run:

haxelib install slug 0.0.1 

See using Haxelib in Haxelib documentation for more information.

README.md

hx-slug

Haxe port of npm slugify.

Installation

$ haxelib install slug

API

Slug.encode(data:String, ?options:SlugOptions):String

Encodes the given data into a slug.

SlugOptions

This is a class with @:structInit, so it can be created from an anonymous structure with some of the fields.

class SlugOptions {
  // If true, all character will be converted to lowercase.
  public final lower:Bool = true;
  
  // If not null, all matches for this regular expression will be
  // removed from the slug.
  // If null, Slug.safe is used.
  public final remove:EReg = null;
  
  // String used to replace spaces.
  public final replacement:String = "-";
}

Example

import haxe.format.Slug;

class Main {
  public static function main():Void {
    trace(Slug.encode("Čokoľvek $ %"));
    // output: cokolvek-dollar-percent
  }
}
Contributors
Aurel300
Version
0.0.1
Published
6 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub