cad3b9c746
git-subtree-dir: packages/relations git-subtree-mainline:b1a6f262ea
git-subtree-split:f1d7081f46
21 lines
540 B
Dart
21 lines
540 B
Dart
String singular(String path) {
|
|
var str = path.trim().split('/').where((str) => str.isNotEmpty).last;
|
|
|
|
if (str.endsWith('ies'))
|
|
return str.substring(0, str.length - 3) + 'y';
|
|
else if (str.endsWith('s'))
|
|
return str.substring(0, str.length - 1);
|
|
else
|
|
return str;
|
|
}
|
|
|
|
String plural(String path) {
|
|
var str = path.trim().split('/').where((str) => str.isNotEmpty).last;
|
|
|
|
if (str.endsWith('y'))
|
|
return str.substring(0, str.length - 1) + 'ies';
|
|
else if (str.endsWith('s'))
|
|
return str;
|
|
else
|
|
return str + 's';
|
|
}
|