How about this then ? At least it wont yield unexpected behaviors.

          var parsedSiteName = WebsitesClient.parseSiteName(name);
          var context = {
            subscription: profile.current.getSubscription(options.subscription).id,
            site: {
              name: parsedSiteName.name
            }
          };

          if (parsedSiteName.slot) {
            throw new Error($('Slot should not be passed in the site name'));
          }