/LocationSlugger.js

Airbnb style location slugs

Primary LanguageJavaScript

A simple library that converts locations, typically provided by something like the Google Place Autocomplete API (or Geocomplete) into URL friendly slugs - in an AirBnb style

Shoreditch Highstreet, London

becomes

Shoreditch-High-Street--London

##Usage

Slug

var slugger = require('location-slugger'),

var result = slugger.slug("Camberley, Surrey");
//returns 'Camberley--Surrey'

Un-Slug

var slugger = require('location-slugger'),

var result = slugger.slug("Camberley--Surrey");
//returns 'Camberley, Surrey'