"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/decamelize/index.js" (7 Feb 2017, 323 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 };