Skip to content

Commit e88d241

Browse files
committed
Update docs
1 parent ae9d663 commit e88d241

File tree

1 file changed

+39
-18
lines changed
  • lib/node_modules/@stdlib/nlp/ordinalize

1 file changed

+39
-18
lines changed

lib/node_modules/@stdlib/nlp/ordinalize/README.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# ordinalize
2222

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.).
2424
2525
<section class="intro">
2626

@@ -38,7 +38,7 @@ var ordinalize = require( '@stdlib/nlp/ordinalize' );
3838

3939
#### ordinalize( value )
4040

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.).
4242

4343
```javascript
4444
var out = ordinalize( '22' );
@@ -54,7 +54,7 @@ The function accepts the following `options`:
5454
- **suffixOnly**: `boolean` indicating whether to return only the ordinal suffix. Default: `false`.
5555
- **gender**: `string` indicating whether to use the `masculine` or `feminine` grammatical form. Default: `'masculine'`.
5656

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.
5858

5959
```javascript
6060
var out = ordinalize( '22', {
@@ -63,7 +63,7 @@ var out = ordinalize( '22', {
6363
// returns 'nd'
6464
```
6565

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.
6767

6868
```javascript
6969
var out = ordinalize( '22', {
@@ -72,32 +72,45 @@ var out = ordinalize( '22', {
7272
// returns '22e'
7373
```
7474

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.
7676

7777
```javascript
78-
var out = ordinalize( 7, {
79-
'lang': 'es'
80-
};
81-
// returns '7ª'
82-
83-
out = ordinalize( 7, {
78+
var opts = {
8479
'lang': 'es',
85-
'gender': 'feminine'
86-
});
80+
'gender': 'masculine'
81+
};
82+
var out = ordinalize( 7, opts );
8783
// returns '7º'
84+
85+
opts.gender = 'feminine';
86+
out = ordinalize( 7, opts );
87+
// returns '7ª'
8888
```
8989

9090
</section>
9191

9292
<!-- /.usage -->
9393

94-
* * *
94+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
9595

96-
<section class="references">
96+
<section class="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.
97110

98111
</section>
99112

100-
<!-- /.references -->
113+
<!-- /.notes -->
101114

102115
<section class="examples">
103116

@@ -115,12 +128,12 @@ out = ordinalize( 2 );
115128
// returns '2nd'
116129

117130
out = ordinalize( '3', {
118-
'suffixOnly': true
131+
'suffixOnly': true
119132
});
120133
// returns 'rd'
121134

122135
out = ordinalize( '3', {
123-
'lang': 'de'
136+
'lang': 'de'
124137
});
125138
// returns '3.'
126139
```
@@ -129,6 +142,14 @@ out = ordinalize( '3', {
129142

130143
<!-- /.examples -->
131144

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+
<section class="references">
148+
149+
</section>
150+
151+
<!-- /.references -->
152+
132153
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
133154

134155
<section class="related">

0 commit comments

Comments
 (0)