mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-10-04 12:10:30 +08:00
Add inflection
This commit is contained in:
1 parent
2147e98170
commit
870dcd34d8
3 files changed
+71
No files matched your search
@@ -0,0 +1,42 @@
|
||||
/// <reference path="inflection.d.ts" />
|
||||
|
||||
import inflection = require("inflection");
|
||||
|
||||
inflection.indexOf(["hi", "there"], "guys");
|
||||
|
||||
inflection.pluralize("person");
|
||||
inflection.pluralize("person", "guys");
|
||||
|
||||
inflection.singularize("Hats");
|
||||
inflection.singularize("guys", "person");
|
||||
|
||||
inflection.inflect("Hats", 1);
|
||||
inflection.inflect("guys", 1, "person");
|
||||
|
||||
inflection.camelize("message_properties");
|
||||
inflection.camelize("message_properties", true);
|
||||
|
||||
inflection.underscore("MP");
|
||||
inflection.underscore("MP", true);
|
||||
|
||||
inflection.humanize("message_properties");
|
||||
inflection.humanize("message_properties", true);
|
||||
|
||||
inflection.capitalize("message_properties");
|
||||
|
||||
inflection.dasherize("message_properties");
|
||||
|
||||
inflection.titleize("message_properties");
|
||||
|
||||
inflection.demodulize("Message::Bus::Properties");
|
||||
|
||||
inflection.tableize("MessageBusProperty");
|
||||
|
||||
inflection.classify("message_bus_properties");
|
||||
|
||||
inflection.foreign_key("MessageBusProperty");
|
||||
inflection.foreign_key("MessageBusProperty", true);
|
||||
|
||||
inflection.ordinalize("the 1 pitch");
|
||||
|
||||
inflection.transform("all job", [ "pluralize", "capitalize", "dasherize" ]);
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for inflection 1.5.0
|
||||
// Project: https://github.com/dreamerslab/node.inflection
|
||||
// Definitions by: Shogo Iwano <https://github.com/shiwano>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Inflection {
|
||||
indexOf<T, T2>(arr: T[], item: T2, from_index?: number, compare_func?: (arr_item: T, item: T2) => boolean): number;
|
||||
pluralize(str: string, plural?: string): string;
|
||||
singularize(str: string, singular?: string): string;
|
||||
inflect(str: string, count: number, singular?: string, plural?: string): string;
|
||||
camelize(str: string, low_first_letter?: boolean): string;
|
||||
underscore(str: string, all_upper_case?: boolean): string;
|
||||
humanize(str: string, low_first_letter?: boolean): string;
|
||||
capitalize(str: string): string;
|
||||
dasherize(str: string): string;
|
||||
titleize(str: string): string;
|
||||
demodulize(str: string): string;
|
||||
tableize(str: string): string;
|
||||
classify(str: string): string;
|
||||
foreign_key(str: string, drop_id_ubar?: boolean): string;
|
||||
ordinalize(str: string): string;
|
||||
transform(str: string, arr: string[]): string;
|
||||
}
|
||||
|
||||
declare module "inflection" {
|
||||
var inflection: Inflection;
|
||||
export = inflection;
|
||||
}
|
||||
Reference in new issue
Block a user