Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StringService

Hierarchy

  • StringService

Index

Properties

Static Private uninflected

uninflected: Array<string> = [ 'Amoyese', 'bison', 'Borghese', 'bream', 'breeches','britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus','Congoese', 'contretemps', 'corps', 'debris', 'diabetes', 'djinn', 'eland', 'elk','equipment', 'Faroese', 'flounder', 'Foochowese', 'gallows', 'Genevese', 'Genoese','Gilbertese', 'graffiti', 'headquarters', 'herpes', 'hijinks', 'Hottentotese','information', 'innings', 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese','mackerel', 'Maltese', '.*?media', 'mews', 'moose', 'mumps', 'Nankingese', 'news','nexus', 'Niasese', 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers','Portuguese', 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese','scissors', 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species','staff', 'swine', 'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese','whiting', 'wildebeest', 'Yengeese' ]

Words that should not be inflected.

var

array

Methods

Static camelToHyphenCase

  • camelToHyphenCase(camel: string): string
  • Converts a camel-cased string to a hyphen-cased one

    Parameters

    • camel: string

      The camel-cased string

    Returns string

    A hyphen-cased string

Static camelToSnakeCase

  • camelToSnakeCase(camel: string): string
  • Converts a camel-cased string to a hyphen-cased one

    Parameters

    • camel: string

      The camel-cased string

    Returns string

    A snake-cased string

Static detectCamelHumps

  • detectCamelHumps(camel: string): string[]
  • Collects all parts of a camel-cased string

    Parameters

    • camel: string

      The camel-cased string

    Returns string[]

    An array of the camel case humps

Static Private flipObject

  • flipObject(data: any): object

Static lowerCaseFirst

  • lowerCaseFirst(str: string): string
  • Lower cases the first character of a string

    Parameters

    • str: string

      The string to lower case the first letter of

    Returns string

    The string with lower-cased first letter

Static pluralize

  • pluralize(word: string): string
  • Returns a word in plural form

    Parameters

    • word: string

      The word in singular form.

    Returns string

    string The word in plural form.

Static singularize

  • singularize(word: string): string
  • Returns a word in singular form

    Parameters

    • word: string

      The word in plural form.

    Returns string

    string The word in singular form.

Static upperCaseFirst

  • upperCaseFirst(str: string): string
  • Upper cases the first character of a string

    Parameters

    • str: string

      The string to upper case the first letter of

    Returns string

    The string with upper-cased first letter

Object literals

Static Private plural

plural: object

Plural inflector rules.

merged

merged: any = {} as any

rules

rules: Map<RegExp, string> = new Map<RegExp, string>([[/(s)tatus$/i, '$1$2tatuses'],[/(quiz)$/i, '$1zes'],[/^(ox)$/i, '$1$2en'],[/([m|l])ouse$/i, '$1ice'],[/(matr|vert|ind)(ix|ex)$/i, '$1ices'],[/(x|ch|ss|sh)$/i, '$1es'],[/([^aeiouy]|qu)y$/i, '$1ies'],[/(hive)$/i, '$1s'],[/(:([^f])fe|([lr])f)$/i, '$1$2ves'],[/sis$/i, 'ses'],[/([ti])um$/i, '$1a'],[/(p)erson$/i, '$1eople'],[/(m)an$/i, '$1en'],[/(c)hild$/i, '$1hildren'],[/(f)oot$/i, '$1eet'],[/(buffal|her|potat|tomat|volcan)o$/i, '$1$2oes'],[/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i, '$1i'],[/us$/i, 'uses'],[/(alias)$/i, '$1es'],[/(analys|ax|cris|test|thes)is$/i, '$1es'],[/s$/, 's'],[/^$/, ''],[/$/, 's'],])

uninflected

uninflected: Array<string> = ['.*[nrlm]ese','.*deer','.*fish','.*measles','.*ois','.*pox','.*sheep','people','cookie']

irregular

irregular: object

atlas

atlas: string = "atlases"

axe

axe: string = "axes"

beef

beef: string = "beefs"

brother

brother: string = "brothers"

cafe

cafe: string = "cafes"

chateau

chateau: string = "chateaux"

child

child: string = "children"

cookie

cookie: string = "cookies"

corpus

corpus: string = "corpuses"

cow

cow: string = "cows"

criterion

criterion: string = "criteria"

curriculum

curriculum: string = "curricula"

demo

demo: string = "demos"

domino

domino: string = "dominoes"

echo

echo: string = "echoes"

foot

foot: string = "feet"

fungus

fungus: string = "fungi"

ganglion

ganglion: string = "ganglions"

genie

genie: string = "genies"

genus

genus: string = "genera"

graffito

graffito: string = "graffiti"

hippopotamus

hippopotamus: string = "hippopotami"

hoof

hoof: string = "hoofs"

human

human: string = "humans"

iris

iris: string = "irises"

leaf

leaf: string = "leaves"

loaf

loaf: string = "loaves"

man

man: string = "men"

medium

medium: string = "media"

memorandum

memorandum: string = "memoranda"

money

money: string = "monies"

mongoose

mongoose: string = "mongooses"

motto

motto: string = "mottoes"

move

move: string = "moves"

mythos

mythos: string = "mythoi"

niche

niche: string = "niches"

nucleus

nucleus: string = "nuclei"

numen

numen: string = "numina"

occiput

occiput: string = "occiputs"

octopus

octopus: string = "octopuses"

opus

opus: string = "opuses"

ox

ox: string = "oxen"

penis

penis: string = "penises"

person

person: string = "people"

plateau

plateau: string = "plateaux"

runner-up

runner-up: string = "runners-up"

sex

sex: string = "sexes"

soliloquy

soliloquy: string = "soliloquies"

son-in-law

son-in-law: string = "sons-in-law"

syllabus

syllabus: string = "syllabi"

testis

testis: string = "testes"

thief

thief: string = "thieves"

tooth

tooth: string = "teeth"

tornado

tornado: string = "tornadoes"

trilby

trilby: string = "trilbys"

turf

turf: string = "turfs"

volcano

volcano: string = "volcanoes"

Static Private singular

singular: object

Singular inflector rules.

merged

merged: any = {} as any

rules

rules: Map<RegExp, string> = new Map<RegExp, string>([[/(s)tatuses$/i, '$1$2tatus'],[/^(.*)(menu)s$/i, '$1$2'],[/(quiz)zes$/i, '$1'],[/(matr)ices$/i, '$1ix'],[/(vert|ind)ices$/i, '$1ex'],[/^(ox)en/i, '$1'],[/(alias)(es)*$/i, '$1'],[/(buffal|her|potat|tomat|volcan)oes$/i, '$1o'],[/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i, '$1us'],[/([ftw]ax)es/i, '$1'],[/(analys|ax|cris|test|thes)es$/i, '$1is'],[/(shoe|slave)s$/i, '$1'],[/(o)es$/i, '$1'],[/ouses$/, 'ouse'],[/([^a])uses$/, '$1us'],[/([m|l])ice$/i, '$1ouse'],[/(x|ch|ss|sh)es$/i, '$1'],[/(m)ovies$/i, '$1$2ovie'],[/(s)eries$/i, '$1$2eries'],[/([^aeiouy]|qu)ies$/i, '$1y'],[/([lr])ves$/i, '$1f'],[/(tive)s$/i, '$1'],[/(hive)s$/i, '$1'],[/(drive)s$/i, '$1'],[/([^fo])ves$/i, '$1fe'],[/(^analy)ses$/i, '$1sis'],[/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '$1$2sis'],[/([ti])a$/i, '$1um'],[/(p)eople$/i, '$1$2erson'],[/(m)en$/i, '$1an'],[/(c)hildren$/i, '$1$2hild'],[/(f)eet$/i, '$1oot'],[/(n)ews$/i, '$1$2ews'],[/eaus$/, 'eau'],[/^(.*us)$/, '$1'],[/s$/i, ''],])

uninflected

uninflected: Array<string> = ['.*[nrlm]ese','.*deer','.*fish','.*measles','.*ois','.*pox','.*sheep','.*ss',]

irregular

irregular: object

criteria

criteria: string = "criterion"

curves

curves: string = "curve"

emphases

emphases: string = "emphasis"

foes

foes: string = "foe"

hoaxes

hoaxes: string = "hoax"

media

media: string = "medium"

neuroses

neuroses: string = "neurosis"

oases

oases: string = "oasis"

waves

waves: string = "wave"

Generated using TypeDoc