Blame view
node_modules/dashify/index.js
433 Bytes
f7563de62
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
/*! * dashify <https://github.com/jonschlinkert/dashify> * * Copyright (c) 2015 Jon Schlinkert. * Licensed under the MIT license. */ 'use strict'; module.exports = function dashify(str) { if (typeof str !== 'string') { throw new TypeError('expected a string'); } str = str.replace(/([a-z])([A-Z])/g, '$1-$2'); str = str.replace(/[ \t\W]/g, '-'); str = str.replace(/^-+|-+$/g, ''); return str.toLowerCase(); }; |