File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed
lib/node_modules/@stdlib/nlp/ordinalize Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 2424interface Options {
2525 /**
2626 * Language code (default: 'en').
27+ *
28+ * ## Notes
29+ *
30+ * Supported languages:
31+ *
32+ * - **en**: English.
33+ * - **es**: Spanish.
34+ * - **fin**: Finnish.
35+ * - **fr**: French.
36+ * - **de**: Dutch.
37+ * - **it**: Italian.
38+ * - **pt**: Portuguese.
39+ * - **swe**: Swedish.
2740 */
2841 lang ?: 'en' | 'es' | 'fin' | 'fr' | 'de' | 'it' | 'pt' | 'swe' ;
2942
Original file line number Diff line number Diff line change @@ -1167,3 +1167,62 @@ tape( 'the function returns an ordinal string for a provided integer string (lan
11671167 }
11681168 t . end ( ) ;
11691169} ) ;
1170+
1171+ tape ( 'the function returns an ordinal string for a provided integer string (lang=swe)' , function test ( t ) {
1172+ var expected ;
1173+ var values ;
1174+ var opts ;
1175+ var i ;
1176+
1177+ values = [
1178+ '1' ,
1179+ '2' ,
1180+ '21' ,
1181+ '7' ,
1182+ '10' ,
1183+ '11' ,
1184+ '12' ,
1185+ '13' ,
1186+ '14' ,
1187+ '15' ,
1188+ '16' ,
1189+ '21' ,
1190+ '22' ,
1191+ '23' ,
1192+ '24' ,
1193+ '332' ,
1194+ '333' ,
1195+ '999'
1196+ ] ;
1197+ expected = [
1198+ '1:a' ,
1199+ '2:a' ,
1200+ '21:a' ,
1201+ '7:e' ,
1202+ '10:e' ,
1203+ '11:e' ,
1204+ '12:e' ,
1205+ '13:e' ,
1206+ '14:e' ,
1207+ '15:e' ,
1208+ '16:e' ,
1209+ '21:a' ,
1210+ '22:a' ,
1211+ '23:e' ,
1212+ '24:e' ,
1213+ '332:a' ,
1214+ '333:e' ,
1215+ '999:e'
1216+ ] ;
1217+
1218+ opts = {
1219+ 'lang' : 'swe'
1220+ } ;
1221+
1222+ for ( i = 0 ; i < values . length ; i ++ ) {
1223+ t . equal ( ordinalize ( values [ i ] , opts ) , expected [ i ] , 'returns expected value' ) ;
1224+ }
1225+ t . end ( ) ;
1226+ } ) ;
1227+
1228+ // FIXME: add suffix only tests
You can’t perform that action at this time.
0 commit comments