src/modulin/css/modulizeCss.js
function generateSubstitution(token, substitutionPattern, substitutions) {
  var substitution = substitutionPattern.replace(/{([^}]+)}/ig, (all, group)=> {
    switch (group) {
      case 'namespace':
        return token.namespace;
      case 'name':
        return token.className;
      case 'random':
        return 'r' + Math.random().toString(36).substring(7);
      case 'hash':
        return 'h' + (token.hash + 0.0).toString(36);
      case 'unique':
        return 'u' + (++uniqueCounter);
    }
  });

  substitutions[token.className] = [];
  substitutions[token.className].push(substitution);
  return substitution;
}
function generateSubstitution(token, substitutionPattern, substitutions) {
  var substitution = substitutionPattern.replace(/{([^}]+)}/ig, (all, group)=> {
    switch (group) {
      case 'namespace':
        return token.namespace;
      case 'name':
        return token.className;
      case 'random':
        return 'r' + Math.random().toString(36).substring(7);
      case 'hash':
        return 'h' + (token.hash + 0.0).toString(36);
      case 'unique':
        return 'u' + (++uniqueCounter);
    }
  });

  substitutions[token.className] = [];
  substitutions[token.className].push(substitution);
  return substitution;
}
function generateSubstitution ( token , substitutionPattern , substitutions ) { var substitution = substitutionPattern . replace ( / {([^}]+)} / ig , ( all , group ) => { switch ( group ) { case 'namespace' : return token . namespace ; case 'name' : return token . className ; case 'random' : return 'r' + Math . random ( ) . toString ( 36 ) . substring ( 7 ) ; case 'hash' : return 'h' + ( token . hash + 0.0 ) . toString ( 36 ) ; case 'unique' : return 'u' + ( ++ uniqueCounter ) ; } } ) ; substitutions [ token . className ] = [ ] ; substitutions [ token . className ] . push ( substitution ) ; return substitution ; }
Generate a substitution for the class or id selector

@param token Token
@param substitutionPattern string
@param substitutions {{string: string[]}}
@returns {string}
Generate a substitution for the class or id selector