Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as Inflector from "inflected";
Inflector.pluralize("Category");
Inflector.singularize("Categories");
Inflector.camelize("nerd_bar", false);
Inflector.underscore('FooBar') // => 'foo_bar'
//Inflector.humanize('employee_salary') // => 'Employee salary'
//Inflector.humanize('author_id') // => 'Author'
Inflector.humanize('author_id', { capitalize: false }) // => 'author'
Inflector.titleize('man from the boondocks') // => 'Man From The Boondocks'
Inflector.titleize('x-men: the last stand') // => 'X Men: The Last Stand'
Inflector.titleize('TheManWithoutAPast') // => 'The Man Without A Past'
Inflector.titleize('raiders_of_the_lost_ark') // => 'Raiders Of The Lost Ark'
Inflector.tableize('RawScaledScorer') // => 'raw_scaled_scorers'
Inflector.tableize('egg_and_ham') // => 'egg_and_hams'
Inflector.tableize('fancyCategory') // => 'fancy_categories'
Inflector.classify('egg_and_hams') // => 'EggAndHam'
Inflector.classify('posts') // => 'Post'
Inflector.dasherize('puni_puni') // => 'puni-puni'
Inflector.foreignKey('Message') // => 'message_id'
Inflector.foreignKey('Message', false) // => 'messageid'
import * as Inflector from "inflected";
Inflector.pluralize("Category");
Inflector.singularize("Categories");
Inflector.camelize("nerd_bar", false);
Inflector.underscore('FooBar') // => 'foo_bar'
//Inflector.humanize('employee_salary') // => 'Employee salary'
//Inflector.humanize('author_id') // => 'Author'
Inflector.humanize('author_id', { capitalize: false }) // => 'author'
Inflector.titleize('man from the boondocks') // => 'Man From The Boondocks'
Inflector.titleize('x-men: the last stand') // => 'X Men: The Last Stand'
Inflector.titleize('TheManWithoutAPast') // => 'The Man Without A Past'
Inflector.titleize('raiders_of_the_lost_ark') // => 'Raiders Of The Lost Ark'
Inflector.tableize('RawScaledScorer') // => 'raw_scaled_scorers'
Inflector.tableize('egg_and_ham') // => 'egg_and_hams'
Inflector.tableize('fancyCategory') // => 'fancy_categories'
Inflector.classify('egg_and_hams') // => 'EggAndHam'
Inflector.classify('posts') // => 'Post'
Inflector.dasherize('puni_puni') // => 'puni-puni'
Inflector.foreignKey('Message') // => 'message_id'
Inflector.foreignKey('Message', false) // => 'messageid'
Inflector.ordinal(1) // => 'st'
function humanReadableName(productDefinition) {
const { name } = attributesFor(productDefinition);
return titleize(name);
}
permissionNames.map(({ permission, name }) => (
{titleize(name)}
))
}
const options = items.map((i) => {
let label;
const attributes = attributesFor(i);
if (typeof labelField === 'string') {
label = attributes[labelField];
} else {
label = labelField(i);
}
const text = titleize(label);
return { text, value: i.id };
});
await update({
variables: {
input: {
id: teamMember.id,
team_member: buildTeamMemberInput(teamMember),
},
},
});
history.replace(`${eventPath}/team_members`);
};
return (
<>
<h1>
{titleize(underscore(event.event_category.team_member_name))}
{' Settings for '}
{teamMember.user_con_profile.name_without_nickname}
</h1>
<dl>
<dt>Email</dt>
<dd>
<a href="{`mailto:${teamMember.user_con_profile.email}`}">
{teamMember.user_con_profile.email}
</a>
</dd>
<dt>Daytime phone</dt>
<dd>
<a href="{`tel:${teamMember.user_con_profile.day_phone}`}">
{teamMember.user_con_profile.day_phone}</a></dd></dl>
.map((permission) => titleize(
getOrganizationRolePermissionName(permission.permission),
))
.join(', ')}
},
},
refetchQueries: [
{ query: TeamMembersQuery, variables: { eventId: event.id } },
],
awaitRefetchQueries: true,
});
history.replace(`${eventPath}/team_members`);
};
return (
<>
<h1>
{'Add '}
{titleize(underscore(event.event_category.team_member_name))}
</h1>
<div>
<label>
{`${humanize(underscore(event.event_category.team_member_name))}`}
{' '}
to add
</label>
</div>
humanReadableName = () => {
const { productDefinition } = this.props;
const { name } = attributesFor(productDefinition);
const readableName = titleize(name);
return readableName;
};
module.exports.convertToTitle = function(string) {
return inflector.titleize('' + (string || ''));
};