src/events/fireEvent.js
function variants(name, initial) {
  const map = initial ? initStars : bubbleStars;
  if (map[name]) return map[name];

  const parts = name.split('.');
  const result = [];
  let base = false;

  // initial events the implicit namespace of 'this'
  if (initial) {
    parts.unshift('this');
    base = true;
  }

  // use max - 1 bits as a bitmap to pick a part or a *
  // need to skip the full star case if the namespace is synthetic
  const max = Math.pow(2, parts.length) - (initial ? 1 : 0);
  for (let i = 0; i < max; i++) {
    const join = [];
    for (let j = 0; j < parts.length; j++) {
      join.push(1 & (i >> j) ? '*' : parts[j]);
    }
    result.unshift(join.join('.'));
  }

  if (base) {
    // include non-this-namespaced versions
    if (parts.length > 2) {
      result.push.apply(result, variants(name, false));
    } else {
      result.push('*');
      result.push(name);
    }
  }

  map[name] = result;
  return result;
}
function variants(name, initial) {
  const map = initial ? initStars : bubbleStars;
  if (map[name]) return map[name];

  const parts = name.split('.');
  const result = [];
  let base = false;

  // initial events the implicit namespace of 'this'
  if (initial) {
    parts.unshift('this');
    base = true;
  }

  // use max - 1 bits as a bitmap to pick a part or a *
  // need to skip the full star case if the namespace is synthetic
  const max = Math.pow(2, parts.length) - (initial ? 1 : 0);
  for (let i = 0; i < max; i++) {
    const join = [];
    for (let j = 0; j < parts.length; j++) {
      join.push(1 & (i >> j) ? '*' : parts[j]);
    }
    result.unshift(join.join('.'));
  }

  if (base) {
    // include non-this-namespaced versions
    if (parts.length > 2) {
      result.push.apply(result, variants(name, false));
    } else {
      result.push('*');
      result.push(name);
    }
  }

  map[name] = result;
  return result;
}
function variants ( name , initial ) { const map = initial ? initStars : bubbleStars ; if ( map [ name ] ) return map [ name ] ; const parts = name . split ( '.' ) ; const result = [ ] ; let base = false ; // initial events the implicit namespace of 'this' if ( initial ) { parts . unshift ( 'this' ) ; base = true ; } // use max - 1 bits as a bitmap to pick a part or a * // need to skip the full star case if the namespace is synthetic const max = Math . pow ( 2 , parts . length ) - ( initial ? 1 : 0 ) ; for ( let i = 0 ; i < max ; i ++ ) { const join = [ ] ; for ( let j = 0 ; j < parts . length ; j ++ ) { join . push ( 1 & ( i >> j ) ? '*' : parts [ j ] ) ; } result . unshift ( join . join ( '.' ) ) ; } if ( base ) { // include non-this-namespaced versions if ( parts . length > 2 ) { result . push . apply ( result , variants ( name , false ) ) ; } else { result . push ( '*' ) ; result . push ( name ) ; } } map [ name ] = result ; return result ; }
cartesian product of name parts and stars adjusted appropriately for special cases
cartesian product of name parts and stars adjusted appropriately for special cases