How to use the fbt.param function in fbt

To help you get started, we’ve selected a few fbt 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 flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should raise an error when call `.param()` with invalid argument', () => {
    // $ExpectError: first argument must be a string
    fbt.param(12, 18);
    // $ExpectError: third argument must be an object
    fbt.param('age', 18, 11);
    // $ExpectError: `abcd` is missing
    fbt.param('age', 18, { abcd: true });
    // $ExpectError
    fbt.param('age', 18, { number: 'need numeber' });

    // $ExpectError: BITMASK_GENDER is missing in enum
    fbt.param('age', 18, { gender: IntlVariations.BITMASK_GENDER });
  });
});
github flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should raise an error when call `.param()` with invalid argument', () => {
    // $ExpectError: first argument must be a string
    fbt.param(12, 18);
    // $ExpectError: third argument must be an object
    fbt.param('age', 18, 11);
    // $ExpectError: `abcd` is missing
    fbt.param('age', 18, { abcd: true });
    // $ExpectError
    fbt.param('age', 18, { number: 'need numeber' });

    // $ExpectError: BITMASK_GENDER is missing in enum
    fbt.param('age', 18, { gender: IntlVariations.BITMASK_GENDER });
  });
});
github flow-typed / flow-typed / definitions / npm / fbt_v0.x.x / flow_v0.69.x- / test_fbt.js View on Github external
it('should pass when used properly', () => {
    fbt.param('age', 18);
    fbt.param('age', 18, {});
    fbt.param('age', 18, { number: true });
    fbt.param('age', 18, { number: 1 });
    fbt.param('age', 18, { gender: IntlVariations.GENDER_UNKNOWN });
    fbt.param('age', 18, { gender: IntlVariations.GENDER_FEMALE });
  });
github facebookincubator / fbt / runtime / shared / __tests__ / mock-fbt-test-typechecks.js View on Github external
it('should munge together fbt.param calls', function() {
    expect(fbt('Hello ' + fbt.param('name', 'bubba'), 'description')).toEqual(
      'Hello bubba',
    );
  });
});
github magma / magma / symphony / app / fbcnms-projects / inventory / app / components / work_orders / WorkOrderComparisonView.js View on Github external
filterConfig.name,
              filterConfig.defaultOperator,
              null,
            )
          }
          onFiltersChanged={filters => setFilters(filters)}
          exportPath={'/work_orders'}
          entity={'WORK_ORDER'}
          footer={
            count !== 0
              ? count > QUERY_LIMIT
                ? fbt(
                    '1 to ' +
                      fbt.param('size of page', QUERY_LIMIT) +
                      ' of ' +
                      fbt.param('total number possible rows', count),
                    'header to indicate partial results',
                  )
                : fbt(
                    '1 to ' + fbt.param('number of results in page', count),
                    'header to indicate number of results',
                  )
              : null
          }
        />
      
    ),
    actionButtons: [
github magma / magma / symphony / app / fbcnms-projects / inventory / app / components / services / AvailableLinksTable.js View on Github external
};

  const onRowClicked = ({_event, _index, rowData}) => {
    onLinkSelected(rowData);
  };

  const linksByOrder = showLinksByOrder(equipment, links);
  if (linksByOrder.length === 0) {
    return (
      <div>
        
      </div>
    );
  }

  return (
    
      {({height, width}) =&gt; (
github magma / magma / symphony / app / fbcnms-projects / inventory / app / components / admin / userManagement / UserManaementView.js View on Github external
].map(type => ({
                    key: type.key,
                    value: type.key,
                    label: fbt(
                      fbt.param('policy type', type.value) + ' Policy',
                      'create policy of given type',
                    ),
                  }))}
                  skin="primary"
github magma / magma / symphony / app / fbcnms-projects / inventory / app / components / admin / userManagement / groups / PermissionsGroupCard.js View on Github external
useEffect(() => {
    if (isOnNewGroup || group != null) {
      return;
    }
    if (fetchedGroup == null) {
      if (groupId != null) {
        handleError(
          `${fbt(
            `Group with id ${fbt.param(
              'group id url param',
              groupId,
            )} does not exist.`,
            '',
          )}`,
        );
      }
      redirectToGroupsView();
    }
    setGroup(fetchedGroup);
  }, [
    fetchedGroup,
github magma / magma / symphony / app / fbcnms-projects / inventory / app / components / HyperlinkTableMenu.js View on Github external
const deleteHandler = useCallback(() => {
    confirm(
      fbt(
        'Are you sure you want to delete link ' +
          fbt.param(
            'Hyperlink display text',
            !!hyperlink.displayName ? `'${hyperlink.displayName}' ` : '',
          ) +
          `to '` +
          fbt.param('Hyperlink target URL', hyperlink.url) +
          `'?`,
        'Hyperlink delete confirmation message',
      ),
    ).then(confirmed => {
      if (!confirmed) {
        return;
      }

      const variables: DeleteHyperlinkMutationVariables = {
        id: hyperlink.id,
      };
github magma / magma / symphony / app / fbcnms-projects / inventory / app / components / CSVUploadDialog.js View on Github external
const summary = responseData.summary;
      setErrors(responseData.errors ?? []);

      if (
        responseData.errors == null ||
        (responseData.errors != null && !verifyBefore) ||
        (responseData.summary.committed && summary.successLines > 0)
      ) {
        onSuccess(
          fbt(
            'Successfully uploaded ' +
              fbt.param('number of saved lines', summary.successLines) +
              ' of ' +
              fbt.param('number of all lines', summary.allLines) +
              ' ' +
              fbt.param('type that was saved', currentEntity) +
              ' items. ',
            'message for a successful import',
          ),
        );
        return;
      }
      if (responseData.errors.length != null && verifyBefore) {
        onWarning(
          fbt(
            'The following ' +
              fbt.param(
                'number of lines',
                responseData.errors.length == 1
                  ? 'line'
                  : responseData.errors.length.toString() + ' lines',
              ) +