Comparing version 0.4.2 to 0.5.0
{ "name": "slug" | ||
, "description": "slugifies even utf-8 chars!" | ||
, "version": "0.4.2" | ||
, "version": "0.5.0" | ||
, "homepage": "https://github.com/dodo/node-slug" | ||
@@ -5,0 +5,0 @@ , "author": "dodo (https://github.com/dodo)" |
@@ -7,2 +7,3 @@ # [slug](https://github.com/dodo/node-slug) | ||
- respecting [RFC 3986](https://tools.ietf.org/html/rfc3986) | ||
- Comprehensive tests | ||
@@ -20,14 +21,18 @@ - No dependencies (except the unicode table) | ||
```bash | ||
master//node-slug » node | ||
> slug = require ('./slug') | ||
> slug('i ♥ unicode') | ||
'i-love-unicode' | ||
> slug('i ♥ unicode', '_') # If you prefer something else then `-` as seperator | ||
'i_love_unicode' | ||
> slug.charmap['♥'] = 'freaking love' # change default charmap or use option {charmap:{…}} as 2. argument | ||
> slug('I ♥ UNICODE').toLowerCase() # If you prefer lower case | ||
'i-freaking-love-unicode' | ||
> slug('unicode ♥ is ☢') # yes! | ||
'unicode-love-is-radioactive' | ||
```javascript | ||
var slug = require('slug') | ||
var print = console.log.bind(console, '>') | ||
print(slug('i ♥ unicode')) | ||
// > i-love-unicode | ||
print(slug('unicode ♥ is ☢')) // yes! | ||
// > unicode-love-is-radioactive | ||
print(slug('i ♥ unicode', '_')) // If you prefer something else then `-` as seperator | ||
// > i_love_unicode | ||
slug.charmap['♥'] = 'freaking love' // change default charmap or use option {charmap:{…}} as 2. argument | ||
print(slug('I ♥ UNICODE').toLowerCase()) // If you prefer lower case | ||
// > i-freaking-love-unicode | ||
``` | ||
@@ -34,0 +39,0 @@ |
@@ -36,3 +36,3 @@ (function (root) { | ||
} | ||
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, ''); // allowed | ||
char = char.replace(/[^\w\s\-\.\_~]/g, ''); // allowed | ||
result += char; | ||
@@ -131,2 +131,2 @@ } | ||
}(this)); | ||
}(this)); |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
124
57
0
18494
8