Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added slugify() helper

  • Loading branch information...
commit ce8c4ecc6dbf21f410c3ac7ae1a899c87f7e0e9f 1 parent f25f40a
TJ Holowaychuk authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 bin/migrate
10 bin/migrate
View
@@ -133,6 +133,14 @@ function log(key, msg) {
console.log(' \033[90m%s :\033[0m \033[36m%s\033[0m', key, msg);
}
+/**
+ * Slugify the given `str`.
+ */
+
+function slugify(str) {
+ return str.replace(/\s+/g, '-');
+}
+
// load config
var config = loadConfig();
@@ -163,7 +171,7 @@ var commands = {
create: function(){
var curr = ++config.prev
- , title = Array.prototype.slice.call(arguments).join(' ');
+ , title = slugify(Array.prototype.slice.call(arguments).join(' '));
// TODO: slug()
// append '-' when title is present
title = title ? curr + '-' + title : curr;
Please sign in to comment.
Something went wrong with that request. Please try again.