Newer
Older
CVSS_3.0_GUI / dist / CVSS_3.0_Calc-1.0.0-linux-x64 / node_modules / nwjs-builder-phoenix / node_modules / yargs / node_modules / decamelize / index.js
root on 7 May 2019 323 bytes Initial commit
  1. 'use strict';
  2. module.exports = function (str, sep) {
  3. if (typeof str !== 'string') {
  4. throw new TypeError('Expected a string');
  5. }
  6.  
  7. sep = typeof sep === 'undefined' ? '_' : sep;
  8.  
  9. return str
  10. .replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
  11. .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
  12. .toLowerCase();
  13. };
Buy Me A Coffee