How to use the humps.pascalize function in humps

To help you get started, we’ve selected a few humps 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 Phyks / ampache_react / app / actions / APIActions.js View on Github external
include
            );
            // Set success callback
            fetchAction.payload.dispatch[1] = (
                jsonData => dispatch => {
                    dispatch(fetchItemSuccess(jsonData));
                }
            );
            // Dispatch action
            dispatch(fetchAction);
        };
    };

    // Remap the above methods to methods including item name
    var returned = {};
    const camelizedAction = humps.pascalize(action);
    returned["loadPaginated" + camelizedAction] = loadPaginatedItems;
    returned["load" + camelizedAction.rstrip("s")] = loadItem;
    return returned;
}
github DefinitelyTyped / DefinitelyTyped / humps / humps-tests.ts View on Github external
humps.camelizeKeys(someObject);

humps.camelizeKeys(someArray);

humps.camelizeKeys(someObject, function (key, convert) {
  return /^[A-Z0-9_]+$/.test(key) ? key : convert(key);
});

humps.decamelizeKeys(someObject, function (key, convert, options) {
  return /^[A-Z0-9_]+$/.test(key) ? key : convert(key, options);
});


humps.camelize('hello_world-foo bar');

humps.pascalize('hello_world-foo bar');

humps.decamelize('helloWorldFooBar');
humps.decamelize('helloWorldFooBar', someOptions);
humps.decamelize('helloWorld1', { split: /(?=[A-Z0-9])/ })

humps.depascalize('helloWorldFooBar');

humps.camelizeKeys(someObject);
humps.pascalizeKeys(someObject);
humps.decamelizeKeys(someObject);
humps.depascalizeKeys(someObject);

humps.camelizeKeys(someObject, someOptions);
humps.pascalizeKeys(someObject, someOptions);
humps.decamelizeKeys(someObject, someOptions);
humps.depascalizeKeys(someObject, someOptions);
github sysgears / apollo-universal-starter-kit / modules / look / client-react / ui-bootstrap / components / RenderCellSelectQuery.jsx View on Github external
render() {
    const { value, schema, style = { width: '80%' } } = this.props;
    const column = schema.keys().find(key => !!schema.values[key].sortBy) || 'name';
    const orderBy = () => {
      const foundOrderBy = schema.keys().find(key => !!schema.values[key].orderBy);
      return foundOrderBy ? { column: foundOrderBy } : null;
    };
    const toString = schema.__.__toString ? schema.__.__toString : opt => opt[column];
    const formattedValue = value ? value.id : '0';
    const Query = schemaQueries[`${pascalize(schema.name)}Query`];

    return (
      
        {({ loading, data }) => {
          if (loading || !data) {
            return ;
          }
          const { edges } = data;
          const renderOptions = () => {
            const defaultOption = formattedValue
              ? []
              : [
                  <option value="0">
                    Select {pascalize(schema.name)}
                  </option>
                ];
github Instawork / hyperview / storybook / helpers.js View on Github external
return (templateName: string, render: any) => {
    const templatePath = `${componentPath}/stories/${templateName}.xml`;
    const storyName = humps.pascalize(templateName);
    const parser = new DOMParser();
    const document = parser.parseFromString(templates[templatePath]);
    const element = getFirstTag(document, Component.localName);
    const stylesheets = Stylesheets.createStylesheets(document);
    s.add(storyName, () => render({ element, stylesheets }));
  };
};
github sysgears / apollo-universal-starter-kit / modules / look / client-react / ui-bootstrap / components / RenderSelectQuery.jsx View on Github external
const renderOptions = () =&gt; {
                const defaultOption =
                  formattedValue === 0
                    ? [
                        <option value="0">
                          Select {pascalize(schema.name)}
                        </option>
                      ]
                    : [];
                return edges
                  ? edges.reduce((acc, opt) =&gt; {
                      acc.push(
                        <option value="{`${opt.id}`}">
                          {toString(opt)}
                        </option>
                      );
                      return acc;
                    }, defaultOption)
                  : defaultOption;
              };
              const props = {
github jscomplete / graphfront / util / index.js View on Github external
toTitleCase(string) {
    return humps.pascalize(string);
  },
github sysgears / apollo-universal-starter-kit / modules / look / client-react / ui-antd / components / RenderSelectQuery.jsx View on Github external
const renderOptions = () =&gt; {
                  const defaultValue = `Select ${pascalize(schema.name)}`;
                  const defaultOption =
                    parseInt(formattedValue.key) === 0
                      ? [
                          <option value="0">
                            {defaultValue}
                          </option>
                        ]
                      : [];
                  return edges
                    ? edges.reduce((acc, opt) =&gt; {
                        acc.push(
                          <option value="{`${opt.id}`}">
                            {toString(opt)}
                          </option>
                        );
                        return acc;
github novemberfiveco / zeplin-styled-components / src / utils / index.js View on Github external
case 'color': {
      return getThemeColor(options, context, value);
    }
    case 'weightText':
    case 'fontWeight':
      return mapFontWeightValueToNumber(value);
    case 'lineHeight':
      return `${round(value / textStyle.fontSize, 2)}`;
    case 'fontSize':
    case 'letterSpacing':
    case 'width':
    case 'height':
    case 'borderRadius':
      return `${round(value, 2)}px`;
    case 'fontFamily':
      return humps.pascalize(value);
    default:
      return value;
  }
};

humps

Underscore-to-camelCase converter (and vice versa) for strings and object keys in JavaScript.

MIT
Latest version published 7 years ago

Package Health Score

53 / 100
Full package analysis