src/PluginSyntaxBabylon.js
function s_SAFE_COMPUTED_OPERANDS(node)
{
   const operands = [];

   if (typeof node.computed === 'boolean' && node.computed)
   {
      // The following will pick up a single literal computed value (string).
      if (node.key.type === 'StringLiteral')
      {
         operands.push(TraitUtil.safeValue(node.key));
      }
      else // Fully evaluate AST node and children for computed operands.
      {
         operands.push(...ASTGenerator.parse(node.key).operands);
      }
   }
   else // Parent is not computed and `parent.key` is an `Identifier` node.
   {
      operands.push(TraitUtil.safeName(node.key));
   }

   return operands;
}
function s_SAFE_COMPUTED_OPERANDS(node)
{
   const operands = [];

   if (typeof node.computed === 'boolean' && node.computed)
   {
      // The following will pick up a single literal computed value (string).
      if (node.key.type === 'StringLiteral')
      {
         operands.push(TraitUtil.safeValue(node.key));
      }
      else // Fully evaluate AST node and children for computed operands.
      {
         operands.push(...ASTGenerator.parse(node.key).operands);
      }
   }
   else // Parent is not computed and `parent.key` is an `Identifier` node.
   {
      operands.push(TraitUtil.safeName(node.key));
   }

   return operands;
}
function s_SAFE_COMPUTED_OPERANDS ( node ) { const operands = [ ] ; if ( typeof node . computed === 'boolean' && node . computed ) { // The following will pick up a single literal computed value (string). if ( node . key . type === 'StringLiteral' ) { operands . push ( TraitUtil . safeValue ( node . key ) ) ; } else // Fully evaluate AST node and children for computed operands. { operands . push ( ... ASTGenerator . parse ( node . key ) . operands ) ; } } else // Parent is not computed and `parent.key` is an `Identifier` node. { operands . push ( TraitUtil . safeName ( node . key ) ) ; } return operands ; }
Provides a utility method that determines the operands of a method for Babylon AST nodes. If the name is a computed
value and not a string literal then `ASTGenerator` is invoked to determine the computed operands.

@param {object}   node - The current AST node.

@returns {Array<*>}
Provides a utility method that determines the operands of a method for Babylon AST nodes . If the name is a computed value and not a string literal then ASTGenerator is invoked to determine the computed operands .