Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
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);
typeNameNormalizer: type => `My${pascalize(type)}`,
});
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>
];
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 }));
};
};
const renderOptions = () => {
const defaultOption =
formattedValue === 0
? [
<option value="0">
Select {pascalize(schema.name)}
</option>
]
: [];
return edges
? edges.reduce((acc, opt) => {
acc.push(
<option value="{`${opt.id}`}">
{toString(opt)}
</option>
);
return acc;
}, defaultOption)
: defaultOption;
};
const props = {
toTitleCase(string) {
return humps.pascalize(string);
},
const renderOptions = () => {
const defaultValue = `Select ${pascalize(schema.name)}`;
const defaultOption =
parseInt(formattedValue.key) === 0
? [
<option value="0">
{defaultValue}
</option>
]
: [];
return edges
? edges.reduce((acc, opt) => {
acc.push(
<option value="{`${opt.id}`}">
{toString(opt)}
</option>
);
return acc;
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;
}
};