github-slugger
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -15,7 +15,9 @@ var emoji = require('emoji-regex') | ||
* @param {string} value String of text to slugify | ||
* @param {boolean} [false] Keep the current case, otherwise make all lowercase | ||
* @return {string} A unique slug string | ||
*/ | ||
BananaSlug.prototype.slug = function (value) { | ||
BananaSlug.prototype.slug = function (value, maintainCase) { | ||
maintainCase = maintainCase === true | ||
var self = this | ||
var slug = slugger(value) | ||
var slug = slugger(value, maintainCase) | ||
var occurrences = self.occurrences[slug] | ||
@@ -52,5 +54,4 @@ | ||
function slugger (string) { | ||
function slugger (string, maintainCase) { | ||
var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g | ||
var maintainCase = false | ||
var replacement = '-' | ||
@@ -57,0 +58,0 @@ |
{ | ||
"name": "github-slugger", | ||
"description": "Generate a slug just like GitHub does for markdown headings.", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"author": "Dan Flettre <fletd01@yahoo.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -13,2 +13,4 @@ var test = require('tape') | ||
t.equals('foo', slugger.slug('foo')) | ||
t.equals('fooCamelCase', slugger.slug('fooCamelCase', true)) | ||
t.equals('foocamelcase', slugger.slug('fooCamelCase')) | ||
@@ -15,0 +17,0 @@ t.end() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12744
229