Permalink
Browse files

added slugify() helper

  • Loading branch information...
1 parent f25f40a commit ce8c4ecc6dbf21f410c3ac7ae1a899c87f7e0e9f @tj committed Apr 22, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 bin/migrate
View
10 bin/migrate
@@ -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;

0 comments on commit ce8c4ec

Please sign in to comment.