Skip to content

Instantly share code, notes, and snippets.

Avatar

Néstor López nesslopz

  • México
View GitHub Profile
@nesslopz
nesslopz / toSlug.js
Created Sep 22, 2019 — forked from igor822/toSlug.js
String to Slug
View toSlug.js
String.prototype.toSlug = function(){
str = this.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "ãàáäâèéëêìíïîõòóöôùúüûñç·/_,:;";
var to = "aaaaaeeeeiiiiooooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@nesslopz
nesslopz / README.md
Last active Mar 19, 2016 — forked from clauswitt/distance.js
Get the distance between two (world) coordinates - a nodejs module
View README.md

distance.js

NodeJs module to calc distances between two points using coords. Originally cloned from https://gist.github.com/1604972. Response is in km

Installation

npm install distance.js --save

Usage

You can’t perform that action at this time.