How to use the change-case/change-case.camelCase function in change-case

To help you get started, we’ve selected a few change-case examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taskcluster / taskcluster / ui / src / components / ClientsTable / index.jsx View on Github external
(clientsConnection, sortBy, sortDirection) => {
      const sortByProperty = camelCase(sortBy);

      if (!sortBy) {
        return clientsConnection;
      }

      return {
        ...clientsConnection,
        edges: [...clientsConnection.edges].sort((a, b) => {
          const firstElement =
            sortDirection === 'desc'
              ? b.node[sortByProperty]
              : a.node[sortByProperty];
          const secondElement =
            sortDirection === 'desc'
              ? a.node[sortByProperty]
              : b.node[sortByProperty];
github taskcluster / taskcluster / ui / src / components / CachePurgesTable / index.jsx View on Github external
(cachePurgesConnection, sortBy, sortDirection) => {
      const sortByProperty = camelCase(sortBy);

      if (!sortBy) {
        return cachePurgesConnection;
      }

      return {
        ...cachePurgesConnection,
        edges: [...cachePurgesConnection.edges].sort((a, b) => {
          const firstElement =
            sortDirection === 'desc'
              ? b.node[sortByProperty]
              : a.node[sortByProperty];
          const secondElement =
            sortDirection === 'desc'
              ? a.node[sortByProperty]
              : b.node[sortByProperty];
github taskcluster / taskcluster / ui / src / components / RolesTable / index.jsx View on Github external
(rolesConnection, sortBy, sortDirection) => {
      const sortByProperty = camelCase(sortBy);

      if (!sortBy) {
        return rolesConnection;
      }

      return {
        ...rolesConnection,
        edges: [...rolesConnection.edges].sort((a, b) => {
          const firstElement =
            sortDirection === 'desc'
              ? b.node[sortByProperty]
              : a.node[sortByProperty];
          const secondElement =
            sortDirection === 'desc'
              ? a.node[sortByProperty]
              : b.node[sortByProperty];
github taskcluster / taskcluster / ui / src / components / CachePurgesTable / index.jsx View on Github external
(cachePurgesConnection, sortBy, sortDirection) => {
      const sortByProperty = camelCase(sortBy);

      if (!sortBy) {
        return cachePurgesConnection;
      }

      return {
        ...cachePurgesConnection,
        edges: [...cachePurgesConnection.edges].sort((a, b) => {
          const firstElement =
            sortDirection === 'desc'
              ? b.node[sortByProperty]
              : a.node[sortByProperty];
          const secondElement =
            sortDirection === 'desc'
              ? a.node[sortByProperty]
              : b.node[sortByProperty];
github taskcluster / taskcluster / ui / src / components / AwsProvisionerHealthTable / index.jsx View on Github external
Object.entries(healthSummary).forEach(([key, item]) => {
        healthSummary[key].healthy =
          or0(item.successful) + or0(item.cleanShutdown) + or0(item.running);
        healthSummary[key].unhealthy =
          or0(item.failed) +
          or0(item.spotKill) +
          or0(item.insufficientCapacity) +
          or0(item.volumeLimitExceeded) +
          or0(item.missingAmi) +
          or0(item.startupFailed) +
          or0(item.unknownCodes) +
          or0(item.noCode);
      });

      const sortByProperty = camelCase(sortBy);
      const healthValues = Object.values(healthSummary);

      if (!sortBy || isEmpty(healthValues)) {
        return healthValues;
      }

      return healthValues.sort((a, b) => {
        const firstElement =
          sortDirection === 'desc' ? b[sortByProperty] : a[sortByProperty];
        const secondElement =
          sortDirection === 'desc' ? a[sortByProperty] : b[sortByProperty];

        return sort(firstElement, secondElement);
      });
    },
    {
github taskcluster / taskcluster / ui / src / components / RolesTable / index.jsx View on Github external
(rolesConnection, sortBy, sortDirection) => {
      const sortByProperty = camelCase(sortBy);

      if (!sortBy) {
        return rolesConnection;
      }

      return {
        ...rolesConnection,
        edges: [...rolesConnection.edges].sort((a, b) => {
          const firstElement =
            sortDirection === 'desc'
              ? b.node[sortByProperty]
              : a.node[sortByProperty];
          const secondElement =
            sortDirection === 'desc'
              ? a.node[sortByProperty]
              : b.node[sortByProperty];
github taskcluster / taskcluster / ui / src / components / ClientsTable / index.jsx View on Github external
(clientsConnection, sortBy, sortDirection) => {
      const sortByProperty = camelCase(sortBy);

      if (!sortBy) {
        return clientsConnection;
      }

      return {
        ...clientsConnection,
        edges: [...clientsConnection.edges].sort((a, b) => {
          const firstElement =
            sortDirection === 'desc'
              ? b.node[sortByProperty]
              : a.node[sortByProperty];
          const secondElement =
            sortDirection === 'desc'
              ? a.node[sortByProperty]
              : b.node[sortByProperty];
github taskcluster / taskcluster / ui / src / components / AwsProvisionerWorkerTypeTable / index.jsx View on Github external
(workerTypes, sortBy, sortDirection, searchTerm) => {
      const sortByProperty = camelCase(sortBy);
      const filteredWorkerTypes = searchTerm
        ? workerTypes.filter(({ workerType }) =>
            workerType.includes(searchTerm)
          )
        : workerTypes;

      return isEmpty(filteredWorkerTypes)
        ? filteredWorkerTypes
        : [...filteredWorkerTypes].sort((a, b) => {
            const firstElement =
              sortDirection === 'desc' ? b[sortByProperty] : a[sortByProperty];
            const secondElement =
              sortDirection === 'desc' ? a[sortByProperty] : b[sortByProperty];

            return sort(firstElement, secondElement);
          });
github taskcluster / taskcluster / ui / src / components / AwsProvisionerErrorsTable / index.jsx View on Github external
(errors, sortBy, sortDirection) => {
      const sortByProperty = camelCase(sortBy);

      if (!errors) {
        return null;
      }

      return [...errors].sort((a, b) => {
        const firstElement =
          sortDirection === 'desc' ? b[sortByProperty] : a[sortByProperty];
        const secondElement =
          sortDirection === 'desc' ? a[sortByProperty] : b[sortByProperty];

        if (sortByProperty === 'type') {
          return sort(
            this.getErrorType(firstElement),
            this.getErrorType(secondElement)
          );