mongoose-url-slugs
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -28,3 +28,3 @@ var extend = require('extend'); | ||
module.exports = function(slugFields, options) { | ||
options = extend(true, defaultOptions, options); | ||
options = extend(true, {}, defaultOptions, options); | ||
@@ -123,2 +123,2 @@ if (slugFields.indexOf(' ') > -1) { | ||
}); | ||
}; | ||
}; |
{ | ||
"author": { | ||
"name": "Talha Asad", | ||
"email": "talha@mindblaze.net", | ||
"email": "talha.asad@agiledevs.com", | ||
"url": "http://mindblaze.net" | ||
@@ -9,3 +9,3 @@ }, | ||
"description": "Create URL compatiable slugs on mongoose models, ensuring uniqueness.", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"keywords": [ | ||
@@ -35,6 +35,6 @@ "mongoose slugs", | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"mocha": "^2.0.1", | ||
"mongoose": "^3.8.19" | ||
"chai": "^2.2.0", | ||
"mocha": "^2.2.4", | ||
"mongoose": "^4.0.1" | ||
} | ||
} |
@@ -18,3 +18,21 @@ [![Build Status](https://travis-ci.org/mindblaze/mongoose-url-slugs.png?branch=master)](https://travis-ci.org/mindblaze/mongoose-url-slugs) | ||
## What is a Slug? | ||
A slug is a human-readable unique identifier that can be used in a URL instead of an ID or hash. This is common in content sites where the title of the article is "slugified" to turn this ugly URL | ||
> http://example.com/a12Qv09b4 | ||
into this pretty one | ||
> http://example.com/your-article-title-here | ||
## How Slugs are Formatted | ||
When supplied with a string, the following steps are taken to transform it into a slug. | ||
- Converted to lower case | ||
- All punctuation is removed | ||
- All spaces are replaced with dashes | ||
- Add a number to the end if the slug isn't unique (eg: `my-cool-slug` and `my-cool-slug-2`) | ||
## Example Usage | ||
@@ -75,2 +93,3 @@ | ||
## History | ||
* v0.1.3 (2015-04-23) -- Fixed an issue with default options being overwritten. | ||
* v0.1.2 (2014-12-09) -- Fixed an issue with index_sparse. | ||
@@ -90,3 +109,3 @@ * v0.1.1 (2014-12-09) -- Fixed an issue due to maxLength. | ||
Copyright (c) 2014 Talha Asad | ||
Copyright (c) 2015 Talha Asad | ||
@@ -109,2 +128,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
SOFTWARE. |
11143
103
126