Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

speakingurl

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speakingurl - npm Package Compare versions

Comparing version 0.18.0 to 0.18.1

LICENSE

2

bower.json
{
"name": "speakingurl",
"version": "0.18.0",
"version": "0.18.1",
"description": "Generate a slug – transliteration with a lot of options",

@@ -5,0 +5,0 @@ "main": "speakingurl.min.js",

Changelog
=========
- v0.18.1 cleanup, update dev dependencies
- v0.18.0 fix #43; add chars to turkish langCharMap; language specific character transliteration
- v0.17.0 pass global to anonymous function #42

@@ -5,0 +7,0 @@ - v0.16.0 add support for italian

@@ -5,3 +5,3 @@ {

"description": "Generate of so called 'static' or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' or 'slug' from a string.",
"version": "0.18.0",
"version": "0.18.1",
"keywords": [

@@ -8,0 +8,0 @@ "slug",

@@ -1,2 +0,2 @@

(function(root) {
(function (root) {
'use strict';

@@ -41,3 +41,3 @@

// custom config is an Array, rewrite to object format
titleCase.forEach(function(v) {
titleCase.forEach(function (v) {
customReplacements[v + ""] = v + "";

@@ -69,3 +69,3 @@ });

// custom replacements
Object.keys(customReplacements).forEach(function(v) {
Object.keys(customReplacements).forEach(function (v) {

@@ -85,3 +85,3 @@ var r;

input = input.replace(/(\w)(\S*)/g, function(_, i, r) {
input = input.replace(/(\w)(\S*)/g, function (_, i, r) {
var j = i.toUpperCase() + (r !== null ? r : "");

@@ -888,3 +888,3 @@ return (Object.keys(customReplacements).indexOf(j.toLowerCase()) < 0) ? j : j.toLowerCase();

// export function for use in AMD
define([], function() {
define([], function () {
return getSlug;

@@ -891,0 +891,0 @@ });

{
"name": "speakingurl",
"version": "0.18.0",
"version": "0.18.1",
"description": "Generate a slug – transliteration with a lot of options",

@@ -51,6 +51,6 @@ "homepage": "http://pid.github.io/speakingurl/",

"gulp-header": "^1.2.2",
"gulp-jsbeautifier": "0.0.3",
"gulp-jsbeautifier": "^0.0.4",
"gulp-jshint": "^1.8.5",
"gulp-load-plugins": "^0.7.0",
"gulp-mocha": "^1.1.1",
"gulp-load-plugins": "^0.8.0",
"gulp-mocha": "^2.0.0",
"gulp-rename": "^1.2.0",

@@ -57,0 +57,0 @@ "gulp-replace": "^0.5.0",

@@ -55,3 +55,3 @@ Speaking URL [![NPM version](https://badge.fury.io/js/speakingurl.png)](http://badge.fury.io/js/speakingurl) [![Build Status](https://travis-ci.org/pid/speakingurl.png)](https://travis-ci.org/pid/speakingurl) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/pid/speakingurl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

- available versions: http://cdnjs.com/libraries/speakingurl/
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.18.0/speakingurl.min.js
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.18.1/speakingurl.min.js

@@ -61,3 +61,3 @@ #### [CDN/maxcdn](https://www.maxcdn.com/)

- available versions: http://www.jsdelivr.com/#!speakingurl
- use //cdn.jsdelivr.net/speakingurl/0.18.0/speakingurl.min.js
- use //cdn.jsdelivr.net/speakingurl/0.18.1/speakingurl.min.js

@@ -336,3 +336,3 @@ Usage

Copyright (c) 2013-2014 Sascha Droste pid@posteo.net All rights reserved.
Copyright (c) 2013-2015 Sascha Droste pid@posteo.net All rights reserved.

@@ -339,0 +339,0 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

/**
* speakingurl
* @version v0.18.0
* @version v0.18.1
* @link http://pid.github.io/speakingurl/

@@ -5,0 +5,0 @@ * @license BSD

@@ -5,10 +5,10 @@ /* global describe,it */

describe('getSlug translate arabic letters', function() {
describe('getSlug translate arabic letters', function () {
'use strict';
it('should be ', function(done) {
it('should be ', function (done) {
getSlug('بشس تاقفغقف - ت ب ي ق', {
lang: 'ar'
})
lang: 'ar'
})
.should.eql('bshs-taqfghqf-t-b-y-q');

@@ -15,0 +15,0 @@

/* global describe,it */
describe('getSlug create', function() {
describe('getSlug create', function () {
'use strict';
it('with symbols', function(done) {
it('with symbols', function (done) {

@@ -22,3 +22,3 @@ var getSlug = require('../lib')

it('without options', function(done) {
it('without options', function (done) {

@@ -34,3 +34,3 @@ var getSlug = require('../lib')

it('with empty options', function(done) {
it('with empty options', function (done) {

@@ -46,3 +46,3 @@ var getSlug = require('../lib')

it('with maintainCase', function(done) {
it('with maintainCase', function (done) {

@@ -60,3 +60,3 @@ var getSlug = require('../lib')

it('with uric', function(done) {
it('with uric', function (done) {

@@ -74,3 +74,3 @@ var getSlug = require('../lib')

it('with uricNoSlash', function(done) {
it('with uricNoSlash', function (done) {

@@ -88,3 +88,3 @@ var getSlug = require('../lib')

it('with mark', function(done) {
it('with mark', function (done) {

@@ -102,3 +102,3 @@ var getSlug = require('../lib')

it('with truncate', function(done) {
it('with truncate', function (done) {

@@ -116,3 +116,3 @@ var getSlug = require('../lib')

it('with separator', function(done) {
it('with separator', function (done) {

@@ -130,3 +130,3 @@ var getSlug = require('../lib')

it('with mark and maintainCase', function(done) {
it('with mark and maintainCase', function (done) {

@@ -145,3 +145,3 @@ var getSlug = require('../lib')

it('with custom chars replacement', function(done) {
it('with custom chars replacement', function (done) {

@@ -161,3 +161,3 @@ var getSlug = require('../lib')

it('with custom chars leet replacement', function(done) {
it('with custom chars leet replacement', function (done) {

@@ -191,3 +191,3 @@ var getSlug = require('../lib')

it('with custom chars replacement with not allowed target char', function(done) {
it('with custom chars replacement with not allowed target char', function (done) {

@@ -207,3 +207,3 @@ var getSlug = require('../lib')

it('with custom chars replacement with allowed target char, option mark', function(done) {
it('with custom chars replacement with allowed target char, option mark', function (done) {

@@ -224,3 +224,3 @@ var getSlug = require('../lib')

it('with custom chars replacement with option mark', function(done) {
it('with custom chars replacement with option mark', function (done) {

@@ -241,3 +241,3 @@ var getSlug = require('../lib')

it('with custom char to string replacement', function(done) {
it('with custom char to string replacement', function (done) {

@@ -264,3 +264,3 @@ var getSlug = require('../lib')

it('with custom string replacement', function(done) {
it('with custom string replacement', function (done) {

@@ -299,3 +299,3 @@ var getSlug = require('../lib')

it('with custom string replacement with option mark', function(done) {
it('with custom string replacement with option mark', function (done) {

@@ -330,3 +330,3 @@ var getSlug = require('../lib')

it('with custom string replacement with option maintainCase', function(done) {
it('with custom string replacement with option maintainCase', function (done) {

@@ -333,0 +333,0 @@ var getSlug = require('../lib')

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug translate cyrillic letters', function() {
describe('getSlug translate cyrillic letters', function () {
'use strict';
it('should be ', function(done) {
it('should be ', function (done) {

@@ -11,0 +11,0 @@ getSlug('Пью')

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug defaults', function() {
describe('getSlug defaults', function () {
'use strict';
it('should replace whitespaces with separator', function(done) {
it('should replace whitespaces with separator', function (done) {

@@ -17,3 +17,3 @@ getSlug('foo bar baz')

it('should remove trailing space if any', function(done) {
it('should remove trailing space if any', function (done) {

@@ -26,3 +26,3 @@ getSlug(' foo bar baz ')

it('should remove multiple whitespaces', function(done) {
it('should remove multiple whitespaces', function (done) {

@@ -35,3 +35,3 @@ getSlug(' foo bar baz FOO BAR BAZ ')

it('should remove multiple separators at start and end', function(done) {
it('should remove multiple separators at start and end', function (done) {

@@ -48,3 +48,3 @@ getSlug('-foo- bar -baz-')

it('should remove multple separators', function(done) {
it('should remove multple separators', function (done) {

@@ -57,3 +57,3 @@ getSlug('foo- bar -baz')

it('should remove non-base64 characters', function(done) {
it('should remove non-base64 characters', function (done) {

@@ -70,3 +70,3 @@ var nonBase64 = ['[', ']', ',', '*', '+', '~', '.', '(', ')', '\'', '"', '!', ':', '@'];

it('should remove trailing separator', function(done) {
it('should remove trailing separator', function (done) {

@@ -80,3 +80,3 @@ getSlug('C\'est un beau titre qui ne laisse rien à désirer ! ')

it('should handle whitespace after symbol', function(done) {
it('should handle whitespace after symbol', function (done) {

@@ -95,4 +95,4 @@ getSlug('∆299')

getSlug('(∆)299', {
mark: true
})
mark: true
})
.should.eql('(delta)299');

@@ -113,3 +113,3 @@

it('should not fail if symbol at the end', function(done) {
it('should not fail if symbol at the end', function (done) {

@@ -116,0 +116,0 @@ getSlug('test &')

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug languages', function() {
describe('getSlug languages', function () {
'use strict';
it('should replace language specific symbols', function(done) {
it('should replace language specific symbols', function (done) {

@@ -99,3 +99,3 @@ var symbolMap = {

Object.keys(symbolMap)
.forEach(function(l) {
.forEach(function (l) {

@@ -105,3 +105,3 @@ // console.log('\ncheck language: ' + l);

Object.keys(symbolMap[l])
.forEach(function(s) {
.forEach(function (s) {

@@ -113,5 +113,5 @@ var k = symbolMap[l][s];

getSlug('Foo ' + s + ' Bar', {
lang: l,
maintainCase: true
})
lang: l,
maintainCase: true
})
.should.eql('Foo-' + getSlug(k, {

@@ -122,4 +122,4 @@ maintainCase: true

getSlug('Foo ' + s + ' Bar', {
lang: l
})
lang: l
})
.should.eql('foo-' + getSlug(k) +

@@ -136,37 +136,37 @@ '-bar');

getSlug('EN Foo & Bar ', {
lang: "en"
})
lang: "en"
})
.should.eql('en-foo-and-bar');
getSlug('de Foo & Bar ', {
lang: "de"
})
lang: "de"
})
.should.eql('de-foo-und-bar');
getSlug('True Foo & Bar ', {
lang: true
})
lang: true
})
.should.eql('true-foo-bar');
getSlug('False Foo & Bar ', {
lang: false
})
lang: false
})
.should.eql('false-foo-bar');
getSlug('xx Foo & Bar ', {
lang: "xx"
})
lang: "xx"
})
.should.eql('xx-foo-and-bar');
getSlug('obj Foo & Bar ', {
lang: {}
})
lang: {}
})
.should.eql('obj-foo-and-bar');
getSlug('array Foo & Bar ', {
lang: []
})
lang: []
})
.should.eql('array-foo-and-bar');
getSlug('null Foo & Bar ', {
lang: null
})
lang: null
})
.should.eql('null-foo-and-bar');

@@ -173,0 +173,0 @@

@@ -5,25 +5,25 @@ /* global describe,it */

describe('getSlug maintainCase', function() {
describe('getSlug maintainCase', function () {
'use strict';
it('should maintain case characters', function(done) {
it('should maintain case characters', function (done) {
getSlug('Foo, Bar Baz', {
maintainCase: true
})
maintainCase: true
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo- Bar Baz', {
maintainCase: true
})
maintainCase: true
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo] Bar Baz', {
maintainCase: true
})
maintainCase: true
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo > Bar ♥ Baz', {
maintainCase: true
})
maintainCase: true
})
.should.eql('Foo-greater-than-Bar-love-Baz');

@@ -30,0 +30,0 @@

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug rfc3986', function() {
describe('getSlug rfc3986', function () {
'use strict';
it('"uric" characters allowed', function(done) {
it('"uric" characters allowed', function (done) {

@@ -16,4 +16,4 @@ var chars = [';', '?', ':', '@', '&', '=', '+', ',', '/'];

getSlug("foo " + chars[i] + " bar baz", {
uric: true
})
uric: true
})
.should.eql("foo-" + chars[i] + "-bar-baz");

@@ -25,3 +25,3 @@ }

it('"uricNoSlash" characters allowed', function(done) {
it('"uricNoSlash" characters allowed', function (done) {

@@ -32,4 +32,4 @@ var chars = [';', '?', ':', '@', '&', '=', '+', ','];

getSlug("foo " + chars[i] + " bar baz", {
uricNoSlash: true
})
uricNoSlash: true
})
.should.eql("foo-" + chars[i] + "-bar-baz");

@@ -41,3 +41,3 @@ }

it('"mark" characters allowed', function(done) {
it('"mark" characters allowed', function (done) {

@@ -48,4 +48,4 @@ var chars = ['.', '!', '~', '*', '\'', '(', ')'];

getSlug("foo " + chars[i] + " bar baz", {
mark: true
})
mark: true
})
.should.eql("foo-" + chars[i] + "-bar-baz");

@@ -57,3 +57,3 @@ }

it('"uric" characters allowed, separator ";"', function(done) {
it('"uric" characters allowed, separator ";"', function (done) {

@@ -64,5 +64,5 @@ var chars = ['?', ':', '@', '&', '=', '+', ',', '/'];

getSlug("foo " + chars[i] + " bar baz", {
uric: true,
separator: ';'
})
uric: true,
separator: ';'
})
.should.eql("foo;" + chars[i] + ";bar;baz");

@@ -74,8 +74,8 @@ }

it('"uric" characters allowed, separator ";" included in input string', function(done) {
it('"uric" characters allowed, separator ";" included in input string', function (done) {
getSlug("foo ; bar baz", {
uric: true,
separator: ';'
})
uric: true,
separator: ';'
})
.should.eql("foo;bar;baz");

@@ -86,3 +86,3 @@

it('"uricNoSlash" characters allowed, separator ";"', function(done) {
it('"uricNoSlash" characters allowed, separator ";"', function (done) {

@@ -93,5 +93,5 @@ var chars = ['?', ':', '@', '&', '=', '+', ','];

getSlug("foo " + chars[i] + " bar baz", {
uricNoSlash: true,
separator: ';'
})
uricNoSlash: true,
separator: ';'
})
.should.eql("foo;" + chars[i] + ";bar;baz");

@@ -103,8 +103,8 @@ }

it('"uricNoSlash" characters allowed, separator ";" included in input string', function(done) {
it('"uricNoSlash" characters allowed, separator ";" included in input string', function (done) {
getSlug("foo ; bar baz", {
uric: true,
separator: ';'
})
uric: true,
separator: ';'
})
.should.eql("foo;bar;baz");

@@ -115,3 +115,3 @@

it('"mark" characters allowed, separator "."', function(done) {
it('"mark" characters allowed, separator "."', function (done) {

@@ -122,5 +122,5 @@ var chars = ['!', '~', '*', '\'', '(', ')'];

getSlug("foo " + chars[i] + " bar baz", {
mark: true,
separator: '.'
})
mark: true,
separator: '.'
})
.should.eql("foo." + chars[i] + ".bar.baz");

@@ -132,8 +132,8 @@ }

it('"mark" characters allowed, separator "." included in input string', function(done) {
it('"mark" characters allowed, separator "." included in input string', function (done) {
getSlug("foo . bar baz", {
uric: true,
separator: '.'
})
uric: true,
separator: '.'
})
.should.eql("foo.bar.baz");

@@ -140,0 +140,0 @@

@@ -5,20 +5,20 @@ /* global describe,it */

describe('getSlug separator', function() {
describe('getSlug separator', function () {
'use strict';
it('should separate with non-whitespace', function(done) {
it('should separate with non-whitespace', function (done) {
getSlug('Foo Bar Baz', {
separator: '-'
})
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug('Foo Bar Baz', {
separator: '*'
})
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug('Foo Bar Baz', {
separator: '_'
})
separator: '_'
})
.should.eql('foo_bar_baz');

@@ -39,17 +39,17 @@

it('should separate with non-whitespace, with trailing spaces', function(done) {
it('should separate with non-whitespace, with trailing spaces', function (done) {
getSlug(' Foo Bar Baz ', {
separator: '-'
})
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug(' Foo Bar Baz ', {
separator: '*'
})
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug(' Foo Bar Baz ', {
separator: '_'
})
separator: '_'
})
.should.eql('foo_bar_baz');

@@ -70,17 +70,17 @@

it('should separate with trailing separator "-"', function(done) {
it('should separate with trailing separator "-"', function (done) {
getSlug('-Foo Bar Baz-', {
separator: '-'
})
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug('--Foo Bar Baz---', {
separator: '-'
})
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug('---Foo Bar Baz---', {
separator: '-'
})
separator: '-'
})
.should.eql('foo-bar-baz');

@@ -100,17 +100,17 @@

it('should separate with trailing separator "*"', function(done) {
it('should separate with trailing separator "*"', function (done) {
getSlug('*Foo Bar Baz*', {
separator: '*'
})
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug('**Foo Bar Baz**', {
separator: '*'
})
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug('***Foo Bar Baz***', {
separator: '*'
})
separator: '*'
})
.should.eql('foo*bar*baz');

@@ -131,17 +131,17 @@

it('should separate with trailing separator "_"', function(done) {
it('should separate with trailing separator "_"', function (done) {
getSlug('_Foo Bar Baz_', {
separator: '_'
})
separator: '_'
})
.should.eql('foo_bar_baz');
getSlug('__Foo Bar Baz__', {
separator: '_'
})
separator: '_'
})
.should.eql('foo_bar_baz');
getSlug('___Foo Bar Baz___', {
separator: '_'
})
separator: '_'
})
.should.eql('foo_bar_baz');

@@ -161,7 +161,7 @@

it('should remove trailing separator "*"', function(done) {
it('should remove trailing separator "*"', function (done) {
getSlug(' C\'est un beau titre qui ne laisse rien à désirer !', {
separator: '*'
})
separator: '*'
})
.should.eql(

@@ -171,3 +171,3 @@ 'c*est*un*beau*titre*qui*ne*laisse*rien*a*desirer');

getSlug(' C\'est un beau titre qui ne laisse rien à désirer !',
'*')
'*')
.should.eql(

@@ -180,3 +180,3 @@ 'c*est*un*beau*titre*qui*ne*laisse*rien*a*desirer');

it('should return empty string because of non string input', function(done) {
it('should return empty string because of non string input', function (done) {

@@ -183,0 +183,0 @@ getSlug(true)

@@ -5,23 +5,23 @@ /* global describe,it */

describe('getSlug config combinations', function() {
describe('getSlug config combinations', function () {
'use strict';
it('should separate with configured character, with non-Base64 separator', function(done) {
it('should separate with configured character, with non-Base64 separator', function (done) {
getSlug('Foo, Bar Baz', {
separator: '*',
maintainCase: false
})
separator: '*',
maintainCase: false
})
.should.eql('foo*bar*baz');
getSlug('Foo- Bar Baz', {
separator: '*',
maintainCase: false
})
separator: '*',
maintainCase: false
})
.should.eql('foo-*bar*baz');
getSlug('Foo] Bar Baz', {
separator: '*',
maintainCase: false
})
separator: '*',
maintainCase: false
})
.should.eql('foo*bar*baz');

@@ -32,20 +32,20 @@

it('should separate with configured character, with only Base64 characters allowed', function(done) {
it('should separate with configured character, with only Base64 characters allowed', function (done) {
getSlug('Foo, Bar Baz', {
separator: '_',
onlyBase64: true
})
separator: '_',
onlyBase64: true
})
.should.eql('foo_bar_baz');
getSlug('Foo- Bar Baz', {
separator: '_',
onlyBase64: true
})
separator: '_',
onlyBase64: true
})
.should.eql('foo-_bar_baz');
getSlug('Foo] Bar Baz', {
separator: '_',
onlyBase64: true
})
separator: '_',
onlyBase64: true
})
.should.eql('foo_bar_baz');

@@ -56,26 +56,26 @@

it('should separate with configured character, with smart trim', function(done) {
it('should separate with configured character, with smart trim', function (done) {
getSlug('Foobarbaz, Bar Baz', {
separator: '_',
truncate: 12
})
separator: '_',
truncate: 12
})
.should.eql('foobarbaz');
getSlug('Foobarbaz, Bar Baz', {
separator: '_',
truncate: 15
})
separator: '_',
truncate: 15
})
.should.eql('foobarbaz_bar');
getSlug(' Foobarbaz, Bar Baz', {
separator: '_',
truncate: 15
})
separator: '_',
truncate: 15
})
.should.eql('foobarbaz_bar');
getSlug(' Foobarbaz, Bar Baz', {
separator: '_',
truncate: 15
})
separator: '_',
truncate: 15
})
.should.eql('foobarbaz_bar');

@@ -86,20 +86,20 @@

it('should maintain case characters, with non-Base64 separator', function(done) {
it('should maintain case characters, with non-Base64 separator', function (done) {
getSlug('Foo, Bar Baz', {
maintainCase: true,
separator: '*'
})
maintainCase: true,
separator: '*'
})
.should.eql('Foo*Bar*Baz');
getSlug('Foo- Bar Baz', {
maintainCase: true,
separator: '*'
})
maintainCase: true,
separator: '*'
})
.should.eql('Foo-*Bar*Baz');
getSlug('Foo] Bar Baz', {
maintainCase: true,
separator: '*'
})
maintainCase: true,
separator: '*'
})
.should.eql('Foo*Bar*Baz');

@@ -110,26 +110,26 @@

it('should maintain case characters, with only Base64 characters allowed', function(done) {
it('should maintain case characters, with only Base64 characters allowed', function (done) {
getSlug('Foo, Bar Baz', {
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo- Bar Baz', {
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo] Bar Baz', {
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('Foo-Bar-Baz');

@@ -140,26 +140,26 @@

it('should maintain case characters, with smart trim', function(done) {
it('should maintain case characters, with smart trim', function (done) {
getSlug('Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 12
})
maintainCase: true,
truncate: 12
})
.should.eql('Foobarbaz');
getSlug('Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 15
})
maintainCase: true,
truncate: 15
})
.should.eql('Foobarbaz-Bar');
getSlug(' Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 15
})
maintainCase: true,
truncate: 15
})
.should.eql('Foobarbaz-Bar');
getSlug(' Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 15
})
maintainCase: true,
truncate: 15
})
.should.eql('Foobarbaz-Bar');

@@ -170,30 +170,30 @@

it('should prefer Base64 characters only', function(done) {
it('should prefer Base64 characters only', function (done) {
getSlug('Foo, Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');
getSlug('Foo- Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');
getSlug('Foo] Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');
getSlug('Foo* Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');

@@ -200,0 +200,0 @@

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug symbols', function() {
describe('getSlug symbols', function () {
'use strict';
it('should convert symbols', function(done) {
it('should convert symbols', function (done) {

@@ -15,34 +15,34 @@ getSlug('Foo & Bar | Baz')

getSlug('Foo & Bar | Baz', {
lang: 'en'
})
lang: 'en'
})
.should.eql('foo-and-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de'
})
lang: 'de'
})
.should.eql('foo-und-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr'
})
lang: 'fr'
})
.should.eql('foo-et-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es'
})
lang: 'es'
})
.should.eql('foo-y-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru'
})
lang: 'ru'
})
.should.eql('foo-i-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cz'
})
lang: 'cz'
})
.should.eql('foo-a-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk'
})
lang: 'sk'
})
.should.eql('foo-a-bar-alebo-baz');

@@ -53,42 +53,42 @@

it('should not convert symbols with uric flag true', function(done) {
it('should not convert symbols with uric flag true', function (done) {
getSlug('Foo & Bar | Baz', {
uric: true
})
uric: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en',
uric: true
})
lang: 'en',
uric: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de',
uric: true
})
lang: 'de',
uric: true
})
.should.eql('foo-&-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr',
uric: true
})
lang: 'fr',
uric: true
})
.should.eql('foo-&-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es',
uric: true
})
lang: 'es',
uric: true
})
.should.eql('foo-&-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru',
uric: true
})
lang: 'ru',
uric: true
})
.should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cz',
uric: true
})
lang: 'cz',
uric: true
})
.should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uric: true
})
lang: 'sk',
uric: true
})
.should.eql('foo-&-bar-alebo-baz');

@@ -98,42 +98,42 @@ done();

it('should not convert symbols with uricNoSlash flag true', function(done) {
it('should not convert symbols with uricNoSlash flag true', function (done) {
getSlug('Foo & Bar | Baz', {
uricNoSlash: true
})
uricNoSlash: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en',
uricNoSlash: true
})
lang: 'en',
uricNoSlash: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de',
uricNoSlash: true
})
lang: 'de',
uricNoSlash: true
})
.should.eql('foo-&-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr',
uricNoSlash: true
})
lang: 'fr',
uricNoSlash: true
})
.should.eql('foo-&-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es',
uricNoSlash: true
})
lang: 'es',
uricNoSlash: true
})
.should.eql('foo-&-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru',
uricNoSlash: true
})
lang: 'ru',
uricNoSlash: true
})
.should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cz',
uricNoSlash: true
})
lang: 'cz',
uricNoSlash: true
})
.should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uricNoSlash: true
})
lang: 'sk',
uricNoSlash: true
})
.should.eql('foo-&-bar-alebo-baz');

@@ -143,49 +143,49 @@ done();

it('should not convert symbols with mark flag true', function(done) {
it('should not convert symbols with mark flag true', function (done) {
getSlug('Foo (Bar) . Baz', {
mark: true
})
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'en',
mark: true
})
lang: 'en',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'de',
mark: true
})
lang: 'de',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'fr',
mark: true
})
lang: 'fr',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'es',
mark: true
})
lang: 'es',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'ru',
mark: true
})
lang: 'ru',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'cz',
mark: true
})
lang: 'cz',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'sk',
mark: true
})
lang: 'sk',
mark: true
})
.should.eql('foo-(bar)-.-baz');

@@ -197,70 +197,70 @@

it('should convert symbols with flags true', function(done) {
it('should convert symbols with flags true', function (done) {
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true
})
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(love)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'de',
uric: true,
uricNoSlash: true,
mark: true
})
lang: 'de',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(liebe)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'fr',
uric: true,
uricNoSlash: true,
mark: true
})
lang: 'fr',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(amour)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'es',
uric: true,
uricNoSlash: true,
mark: true
})
lang: 'es',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(amor)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'ru',
uric: true,
uricNoSlash: true,
mark: true
})
lang: 'ru',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(lubov)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'cz',
uric: true,
uricNoSlash: true,
mark: true
})
lang: 'cz',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(laska)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'sk',
uric: true,
uricNoSlash: true,
mark: true
})
lang: 'sk',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(laska)-;-baz=bar');
getSlug(' Sch(* )ner (♥)Ti♥tel ♥läßt grüßen!? Bel♥♥ été !', {
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true,
maintainCase: true
})
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true,
maintainCase: true
})
.should.eql(
'Sch(*-)ner-(love)Ti-love-tel-love-laesst-gruessen!?-Bel-love-love-ete-!'
);
);

@@ -270,13 +270,13 @@ done();

it('should replace symbols (de)', function(done) {
it('should replace symbols (de)', function (done) {
getSlug('Äpfel & Birnen', {
lang: 'de'
})
lang: 'de'
})
.should.eql('aepfel-und-birnen');
getSlug('ÄÖÜäöüß', {
lang: 'de',
maintainCase: true
})
lang: 'de',
maintainCase: true
})
.should.eql('AeOeUeaeoeuess');

@@ -287,19 +287,19 @@

it('should replace chars by cz language standards', function(done) {
it('should replace chars by cz language standards', function (done) {
getSlug(
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cz'
})
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cz'
})
.should.eql(
'aaaabbccccddddeeeeeeffgghhchchiiiijjkkllmmnnnnooooppqqrrrrssssttttuuuuuuvvwwxxyyyyzzzz'
);
);
getSlug(
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cz',
maintainCase: true
})
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cz',
maintainCase: true
})
.should.eql(
'AaAaBbCcCcDdDdEeEeEeFfGgHhChchIiIiJjKkLlMmNnNnOoOoPpQqRrRrSsSsTtTtUuUuUuVvWwXxYyYyZzZz'
);
);

@@ -309,19 +309,19 @@ done();

it('should replace chars by sk language standards', function(done) {
it('should replace chars by sk language standards', function (done) {
getSlug(
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk'
})
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk'
})
.should.eql(
'aaaaaabbccccdddddzdzdzdzeeeeffgghhchchiiiijjkkllllllmmnnnnooooooppqqrrrrssssttttuuuuvvwwxxyyyyzzzz'
);
);
getSlug(
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk',
maintainCase: true
})
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk',
maintainCase: true
})
.should.eql(
'AaAaAaBbCcCcDdDdDzdzDzdzEeEeFfGgHhChchIiIiJjKkLlLlLlMmNnNnOoOoOoPpQqRrRrSsSsTtTtUuUuVvWwXxYyYyZzZz'
);
);

@@ -331,7 +331,7 @@ done();

it('should ignore not available language param', function(done) {
it('should ignore not available language param', function (done) {
getSlug('Äpfel & Birnen', {
lang: 'xx'
})
lang: 'xx'
})
.should.eql('aepfel-and-birnen');

@@ -342,17 +342,17 @@

it('should convert currency symbols to lowercase', function(done) {
it('should convert currency symbols to lowercase', function (done) {
getSlug('NEXUS4 only €199!', {
maintainCase: false
})
maintainCase: false
})
.should.eql('nexus4-only-eur199');
getSlug('NEXUS4 only €299.93', {
maintainCase: false
})
maintainCase: false
})
.should.eql('nexus4-only-eur299-93');
getSlug('NEXUS4 only 円399.73', {
maintainCase: false
})
maintainCase: false
})
.should.eql('nexus4-only-yen399-73');

@@ -363,17 +363,17 @@

it('should convert currency symbols to uppercase', function(done) {
it('should convert currency symbols to uppercase', function (done) {
getSlug('NEXUS4 only €199!', {
maintainCase: true
})
maintainCase: true
})
.should.eql('NEXUS4-only-EUR199');
getSlug('NEXUS4 only €299.93', {
maintainCase: true
})
maintainCase: true
})
.should.eql('NEXUS4-only-EUR299-93');
getSlug('NEXUS4 only 円399.73', {
maintainCase: true
})
maintainCase: true
})
.should.eql('NEXUS4-only-YEN399-73');

@@ -380,0 +380,0 @@

@@ -5,20 +5,20 @@ /* global describe,it */

describe('getSlug titleCase', function() {
describe('getSlug titleCase', function () {
'use strict';
it('should title-case the characters', function(done) {
it('should title-case the characters', function (done) {
getSlug('This is big foo', {
titleCase: true
})
titleCase: true
})
.should.eql('This-Is-Big-Foo');
getSlug('This is Big foo', {
titleCase: true
})
titleCase: true
})
.should.eql('This-Is-Big-Foo');
getSlug('Don\'t drink and drive', {
titleCase: true
})
titleCase: true
})
.should.eql('Don-t-Drink-And-Drive');

@@ -29,39 +29,39 @@

it('should title-case the characters with custom array', function(done) {
it('should title-case the characters with custom array', function (done) {
getSlug('This is yet foo and bar', {
titleCase: ['and', 'yet']
})
titleCase: ['and', 'yet']
})
.should.eql('This-Is-yet-Foo-and-Bar');
getSlug('This is a foo and an angry bird', {
titleCase: ['a', 'an', 'and']
})
titleCase: ['a', 'an', 'and']
})
.should.eql('This-Is-a-Foo-and-an-Angry-Bird');
getSlug('This is a foo and an angry bird show', {
titleCase: ['a']
})
titleCase: ['a']
})
.should.eql('This-Is-a-Foo-And-An-Angry-Bird-Show');
getSlug('Don\'t drink and drive', {
titleCase: ['and']
})
titleCase: ['and']
})
.should.eql('Don-t-Drink-and-Drive');
getSlug('Don\'t drink and drive', {
titleCase: {}
})
titleCase: {}
})
.should.eql('Don-t-Drink-And-Drive');
getSlug('Don\'t drink and drive', {
titleCase: {
'drink': 'drive'
}
})
titleCase: {
'drink': 'drive'
}
})
.should.eql('Don-t-Drink-And-Drive');
getSlug('Don\'t drink and drive', {
titleCase: 42
})
titleCase: 42
})
.should.eql('Don-t-Drink-And-Drive');

@@ -68,0 +68,0 @@

@@ -5,60 +5,60 @@ /* global describe,it */

describe('getSlug smart truncate', function() {
describe('getSlug smart truncate', function () {
'use strict';
it('should maintain case characters, with smart truncate', function(done) {
it('should maintain case characters, with smart truncate', function (done) {
getSlug('Foobarbaz, Bar Baz', {
truncate: 12
})
truncate: 12
})
.should.eql('foobarbaz');
getSlug('Foobarbaz, Bar Baz', {
truncate: 15
})
truncate: 15
})
.should.eql('foobarbaz-bar');
getSlug(' Foobarbaz, Bar Baz', {
truncate: 15
})
truncate: 15
})
.should.eql('foobarbaz-bar');
getSlug(' Foobarbaz, Bar Baz', {
truncate: 15
})
truncate: 15
})
.should.eql('foobarbaz-bar');
getSlug('Foo Foo bar Zoo Bar Baz', {
truncate: 15
})
truncate: 15
})
.should.eql('foo-foo-bar-zoo');
getSlug('Foo Foo bar ZooBar Baz', {
truncate: 15
})
truncate: 15
})
.should.eql('foo-foo-bar');
getSlug('Foo Foo bar ZooBar Baz', {
truncate: 15
})
truncate: 15
})
.should.eql('foo-foo-bar');
getSlug('Foo Foo Bar Bar', {
truncate: "foo"
})
truncate: "foo"
})
.should.eql('foo-foo-bar-bar');
getSlug('Foo Foo Bar Bar', {
truncate: false
})
truncate: false
})
.should.eql('foo-foo-bar-bar');
getSlug('Foo Foo Bar Bar', {
truncate: true
})
truncate: true
})
.should.eql('foo-foo-bar-bar');
getSlug('a Foo', {
truncate: true
})
truncate: true
})
.should.eql('a-foo');

@@ -65,0 +65,0 @@

@@ -5,15 +5,15 @@ /* global describe,it */

describe('getSlug translate turkish letters', function() {
describe('getSlug translate turkish letters', function () {
'use strict';
it('should be ', function(done) {
it('should be ', function (done) {
getSlug('ÜÄÖüäö', {
lang: 'tr'
})
lang: 'tr'
})
.should.eql('uaeouaeo');
getSlug('ÜÖÄ äüö', {
lang: 'tr'
})
lang: 'tr'
})
.should.eql('uoae-aeuo');

@@ -20,0 +20,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc