Gathering detailed insights and metrics for speakingurl
Gathering detailed insights and metrics for speakingurl
Gathering detailed insights and metrics for speakingurl
Gathering detailed insights and metrics for speakingurl
@types/speakingurl
TypeScript definitions for speakingurl
mongoose-slug-plugin
Slugs for Mongoose with history and i18n support (uses speakingurl by default, but you can use any slug library such as limax, slugify, mollusc, or slugme)
@fixers/speakingurl
A revived SpeakingURL with some modern ESM tech
angular-slugifier
AngularJS bindings for the wonderful speakingurl library
Generate a slug – transliteration with a lot of options
npm install speakingurl
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,116 Stars
429 Commits
84 Forks
20 Watching
2 Branches
31 Contributors
Updated on 09 Nov 2024
JavaScript (98.86%)
Ruby (0.95%)
Makefile (0.18%)
Cumulative downloads
Total Downloads
Last day
5.4%
197,898
Compared to previous day
Last week
6.8%
1,026,860
Compared to previous week
Last month
18.1%
4,169,764
Compared to previous month
Last year
246.2%
27,274,779
Compared to previous year
Generate a slug with a lot of options; create a so-called Semantic URL or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' from a string. This module aims to transliterate the input string.
For use in browser and server - no dependencies!
1npm install speakingurl --save
1yarn add speakingurl --dev
1bower install --save speakingurl
1component install pid/speakingurl
1# Add to Gemfile 2gem 'speakingurl-rails'
copy the file speakingurl.min.js to your script directory
available versions:
available versions:
input
: {string} to convert
options
{object|string} config object or separator string (see below)
options
{object}
separator
{string} default: '-'
lang
{string|boolean} default: 'en' // ISO 639-1 Codes
symbols
{boolean} default: true
maintainCase
{boolean} default: false
titleCase
{boolean|array} default: false
truncate
{number} default: 0
uric
{boolean} default: false
uricNoSlash
{boolean} default: false
mark
{boolean} default: false
custom
{object|array} default: {}
options
{string} separator
notes: default only Base64 chars are allowed (/A-Za-z0-9_-/), setting uric
, uricNoSlash
or/and mark
to true
will add the specified chars to the list of allowed characters. The separator-character is always allowed.
1var getSlug = require('speakingurl');
1<script src="bower_components/speakingurl/speakingurl.min.js"></script>
1# Add to application.js 2//= require speakingurl
1var slug; 2 3slug = getSlug("Schöner Titel läßt grüßen!? Bel été !"); 4console.log(slug); // Output: schoener-titel-laesst-gruessen-bel-ete 5 6slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", '*'); 7console.log(slug); // Output: schoener*titel*laesst*gruessen*bel*ete 8 9slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", { 10 separator: '_' 11 }); 12console.log(slug); // Output: schoener_titel_laesst_gruessen_bel_ete 13 14slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", { 15 uric: true 16 }); 17console.log(slug); // Output: schoener-titel-laesst-gruessen?-bel-ete 18 19slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", { 20 uricNoSlash: true 21 }); 22console.log(slug); // Output: schoener-titel-laesst-gruessen?-bel-ete 23 24slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", { 25 mark: true 26 }); 27console.log(slug); // Output: schoener-titel-laesst-gruessen!-bel-ete-! 28 29slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", { 30 truncate: 20 31 }); 32console.log(slug); // Output: schoener-titel 33 34slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", { 35 maintainCase: true 36 }); 37console.log(slug); // Output: Schoener-Titel-laesst-gruessen-Bel-ete 38 39slug = getSlug("Äpfel & Birnen!", { 40 lang: 'de' 41 }); 42console.log(slug); // Output: aepfel-und-birnen 43 44slug = getSlug("မြန်မာ သာဓက", { 45 lang: 'my' 46 }); 47console.log(slug); // Output: myanma-thadak 48 49slug = getSlug('މިއަދަކީ ހދ ރީތި ދވހކވ', { 50 lang: 'dv' 51 }); 52console.log(slug); // Output: miadhakee hd reethi dvhkv 53 54slug = getSlug("Apple & Pear!", { 55 lang: 'en' // lang: "en" is default, just to clarify 56 }); 57console.log(slug); // Output: apple-and-pear 58 59slug = getSlug('Foo & Bar * Baz', { 60 custom: { 61 '&': ' doo ' 62 }, 63 uric:true 64 }); 65console.log(slug); // Output: foo-doo-bar-baz 66 67slug = getSlug('Foo ♥ Bar'); 68console.log(slug); // Output: foo-love-bar 69 70slug = getSlug('Foo & Bar | (Baz) * Doo', { 71 custom: { 72 '*': 'Boo' 73 }, 74 mark:true 75 }); 76console.log(slug); // Output: foo-and-bar-or-(baz)-boo-doo 77 78slug = getSlug('Foo and Bar or Baz', { 79 custom: { 80 'and': 'und', 81 'or': '' 82 } 83 }); 84console.log(slug); // Output: foo-und-bar-baz 85 86slug = getSlug('[Knöpfe]', { 87 custom: [ 88 '[', 89 ']' 90 ] 91 }); 92console.log(slug); // Output: [knoepfe] 93 94slug = getSlug('NEXUS4 only $299'); 95console.log(slug); // Output: nexus-4-only-usd299 96 97slug = getSlug('NEXUS4 only €299', { 98 maintainCase: true 99 }); 100console.log(slug); // Output: NEXUS-4-only-EUR299 101 102slug = getSlug('Don\'t drink and drive', { 103 titleCase: true 104 }); 105console.log(slug); // Output: Don-t-Drink-And-Drive 106 107slug = getSlug('Don\'t drink and drive', { 108 titleCase: ['and'] 109 }); 110console.log(slug); // Output: Don-t-Drink-and-Drive 111 112slug = getSlug('Foo & Bar ♥ Foo < Bar', { 113 lang: false 114 }); 115console.log(slug); // Output: foo-bar-foo-bar 116 117slug = getSlug('Foo & Bar ♥ Foo < Bar', { 118 symbols: false 119 }); 120console.log(slug); // Output: foo-bar-foo-bar 121 122slug = getSlug('ä♥ä', { 123 lang: 'tr', 124 symbols: false 125 }); 126console.log(slug); // Output: a
options
: {object|string} config object or separator string (see above)
Create your own specially configured function.
1var options = { 2 maintainCase: true, 3 separator: '_' 4 }; 5 6var mySlug = require('speakingurl').createSlug(options); 7// in browser: 8// var mySlug = createSlug(options); 9 10var slug = mySlug("Schöner Titel läßt grüßen!? Bel été !"); 11console.log(slug); // Output: Schoener_Titel_laesst_gruessen_Bel_ete
Create your own specially configured function with title-case feature.
1var options = { 2 titleCase: [ 3 "a","an","and","as","at","but", 4 "by","en","for","if","in","nor", 5 "of","on","or","per","the","to","vs" 6 ] 7 }; 8 9var mySlug = require('speakingurl').createSlug(options); 10// in browser: 11// var mySlug = createSlug(options); 12 13var slug = mySlug('welcome to the jungle'); 14console.log(slug); // Output: Welcome-to-the-Jungle
see CHANGELOG.md
1npm test
1 2# fork pid/speakingurl on Github 3$ git clone git@github.com:<YOUR_USER>/speakingurl.git 4$ cd speakingurl 5$ npm install 6# add your stuff 7# add tests 8# add example for new feature 9# add release info to CHANGELOG.md 10# add description/example to README.md 11$ gulp 12$ commit files (speakingurl.min.js,...) 13# if everything works fine, commit, push to your repository 14# create pull request
1$ gulp bumpup --patch # --minor # --major 2$ gulp 3$ gulp release
1$ gulp 2$ gem build speakingurl-rails.gemspec 3$ gem push speakingurl-rails-x.x.x.gem
The BSD 3-Clause License (BSD3)
Copyright (c) 2013-2017 Sascha Droste pid@posteo.net All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/24 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
32 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More