You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/nlp/ordinalize/README.md
+39-18Lines changed: 39 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ limitations under the License.
20
20
21
21
# ordinalize
22
22
23
-
> Turn an integer into an ordinal string (e.g., `1st`, `2nd`, etc.).
23
+
> Convert an integer to an ordinal string (e.g., `1st`, `2nd`, etc.).
24
24
25
25
<sectionclass="intro">
26
26
@@ -38,7 +38,7 @@ var ordinalize = require( '@stdlib/nlp/ordinalize' );
38
38
39
39
#### ordinalize( value )
40
40
41
-
Turns an integer into an ordinal string (e.g., `1st`, `2nd`, etc.).
41
+
Converts an integer to an ordinal string (e.g., `1st`, `2nd`, etc.).
42
42
43
43
```javascript
44
44
var out =ordinalize( '22' );
@@ -54,7 +54,7 @@ The function accepts the following `options`:
54
54
-**suffixOnly**: `boolean` indicating whether to return only the ordinal suffix. Default: `false`.
55
55
-**gender**: `string` indicating whether to use the `masculine` or `feminine` grammatical form. Default: `'masculine'`.
56
56
57
-
By default, the function returns the ordinal string. To return only the ordinal suffix, set the `suffixOnly` option.
57
+
By default, the function returns an ordinal string. To return only an ordinal suffix, set the `suffixOnly` option.
58
58
59
59
```javascript
60
60
var out =ordinalize( '22', {
@@ -63,7 +63,7 @@ var out = ordinalize( '22', {
63
63
// returns 'nd'
64
64
```
65
65
66
-
By default, the function returns the ordinal string in English. To return the ordinal string in a different language, set the `lang` option.
66
+
By default, the function returns an ordinal string in English. To return an ordinal string for a different language, set the `lang` option.
67
67
68
68
```javascript
69
69
var out =ordinalize( '22', {
@@ -72,32 +72,45 @@ var out = ordinalize( '22', {
72
72
// returns '22e'
73
73
```
74
74
75
-
If the respective language differentiates between the `masculine` and `feminine` grammatical forms, the functions returns by default the ordinal string in the masculine form. To return the ordinal string in the feminine form, set the `gender` option.
75
+
By default, if a language differentiates between masculine and feminine grammatical forms, the functions returns an ordinal string in the masculine form. To return an ordinal string in the feminine form, set the `gender` option.
76
76
77
77
```javascript
78
-
var out =ordinalize( 7, {
79
-
'lang':'es'
80
-
};
81
-
// returns '7ª'
82
-
83
-
out =ordinalize( 7, {
78
+
var opts = {
84
79
'lang':'es',
85
-
'gender':'feminine'
86
-
});
80
+
'gender':'masculine'
81
+
};
82
+
var out =ordinalize( 7, opts );
87
83
// returns '7º'
84
+
85
+
opts.gender='feminine';
86
+
out =ordinalize( 7, opts );
87
+
// returns '7ª'
88
88
```
89
89
90
90
</section>
91
91
92
92
<!-- /.usage -->
93
93
94
-
* * *
94
+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
95
95
96
-
<section class="references">
96
+
<sectionclass="notes">
97
+
98
+
## Notes
99
+
100
+
- The following languages are supported:
101
+
102
+
-**en**: English.
103
+
-**es**: Spanish.
104
+
-**fin**: Finnish.
105
+
-**fr**: French.
106
+
-**de**: Dutch.
107
+
-**it**: Italian.
108
+
-**pt**: Portuguese.
109
+
-**swe**: Swedish.
97
110
98
111
</section>
99
112
100
-
<!-- /.references -->
113
+
<!-- /.notes-->
101
114
102
115
<sectionclass="examples">
103
116
@@ -115,12 +128,12 @@ out = ordinalize( 2 );
115
128
// returns '2nd'
116
129
117
130
out =ordinalize( '3', {
118
-
'suffixOnly':true
131
+
'suffixOnly':true
119
132
});
120
133
// returns 'rd'
121
134
122
135
out =ordinalize( '3', {
123
-
'lang':'de'
136
+
'lang':'de'
124
137
});
125
138
// returns '3.'
126
139
```
@@ -129,6 +142,14 @@ out = ordinalize( '3', {
129
142
130
143
<!-- /.examples -->
131
144
145
+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
146
+
147
+
<sectionclass="references">
148
+
149
+
</section>
150
+
151
+
<!-- /.references -->
152
+
132
153
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
0 commit comments