github-slugid
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,3 +5,3 @@ | ||
'$', '%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=', | ||
'>', '?', '@', '', '', '^', '_', '`', '{', '|', '}', '~', '-', | ||
'>', '?', '@', '', '', '^', '_', '`', '{', '|', '}', '~', | ||
'©', '∑', '®', '†', '“', '”', '‘', '’', '∂', 'ƒ', '™', '℠', '…', | ||
@@ -8,0 +8,0 @@ 'œ', 'Œ','˚', 'º', 'ª', '•', '∆', '∞', '♥', '&', '|' |
{ | ||
"name": "github-slugid", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Slugify like GitHub", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "export TESTING=true; mocha --reporter list" | ||
"test": "export TESTING=true; mocha --reporter list --bail" | ||
}, | ||
@@ -14,0 +14,0 @@ "repository": { |
@@ -22,2 +22,3 @@ # github-slugid | ||
[Examples on GitHub](https://gist.github.com/SamyPesse/b3594cc813f026b3fd42) | ||
[Examples on GitHub](https://gist.github.com/SamyPesse/b3594cc813f026b3fd42) | ||
[Reference](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb) |
var slug = require('../'); | ||
var should = require('should'); | ||
describe('slug', function () { | ||
it('should replace whitespaces', function() { | ||
slug('hello').should.equal('hello'); | ||
slug('hello world').should.equal('hello-world'); | ||
}); | ||
var MATCHES = { | ||
'hello': 'hello', | ||
'hello world': 'hello-world', | ||
'!weird + id/for headings': 'weird--idfor-heading', | ||
'您好': '您好', | ||
'I ♥ you': 'i--you', | ||
'a > b': 'a--b', | ||
'Schöner Titel läßt grüßen!? Bel été !': 'schöner-titel-läßt-grüßen-bel-été-' | ||
} | ||
it('should replace with lowercase', function() { | ||
slug('Hello World').should.equal('hello-world'); | ||
}); | ||
it('should remove leading separator', function() { | ||
slug('!weird + id/for headings').should.equal('weird--idfor-headings'); | ||
}); | ||
it('should accept chinese', function() { | ||
slug('您好').should.equal('您好'); | ||
}); | ||
describe('slug', function () { | ||
for (var value in MATCHES) { | ||
var expected = MATCHES[value]; | ||
it('should remove symbols', function() { | ||
slug('I ♥ you').should.equal('i--you'); | ||
slug('a > b').should.equal('a--b'); | ||
}); | ||
it('should handle '+ JSON.stringify(value), function() { | ||
slug(value).should.equal(expected); | ||
}); | ||
it('should follow github', function() { | ||
slug('Schöner Titel läßt grüßen!? Bel été !').should.equal('schöner-titel-läßt-grüßen-bel-été-'); | ||
}) | ||
it('should handle '+ JSON.stringify(expected), function() { | ||
slug(expected).should.equal(expected); | ||
}); | ||
} | ||
}); | ||
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
24
14533
40