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: README-summary.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,7 @@ View the documentation of previous major releases:
95
95
-[`Prettify`](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#prettify) - expands a complex type into a more readable format while keeping functionality the same
96
96
-[`ValueGen`](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#valuegen) - a "generator" value that allows for super flexible value typing and declaration
97
97
-[`StringGen`](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#stringgen) - a "generator" string that allows for super flexible string typing and declaration, including enhanced support for unions
98
+
-[`ListWithLength`](https://github.com/Sv443-Network/UserUtils/blob/main/docs.md#listwithlength) - represents an array or object with a numeric `length`, `count` or `size` property
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,7 @@ View the documentation of previous major releases:
102
102
-[`Prettify`](./docs.md#prettify) - expands a complex type into a more readable format while keeping functionality the same
103
103
-[`ValueGen`](./docs.md#valuegen) - a "generator" value that allows for super flexible value typing and declaration
104
104
-[`StringGen`](./docs.md#stringgen) - a "generator" string that allows for super flexible string typing and declaration, including enhanced support for unions
105
+
-[`ListWithLength`](./docs.md#listwithlength) - represents an array or object with a numeric `length`, `count` or `size` property
autoPlural(str: string, num: number|Array|NodeList| { length: number } | { count: number } | { size: number }): string
1934
1935
```
1935
1936
1936
1937
Crudely pluralizes a string by appending an `s` if the given number is not 1.
1937
-
If an array or NodeList is passed, the amount of contained items will be used.
1938
-
1939
-
Of course some English words go from `-y` to `-ies`, in which case this function will not work.
1938
+
If an array or NodeList or object with either a `length`, `count` or `size` property is passed, the amount of contained items will be used.
1939
+
Iterables will not work until converted to an array (with `Array.from()` or `[...iterable]`).
1940
+
1941
+
Some English words go from `-y` to `-ies`. Using this function in that case will not work.
1940
1942
1941
1943
<details><summary><b>Example - click to view</b></summary>
1942
1944
@@ -3150,6 +3152,40 @@ Remember that [`Stringifiable`](#stringifiable) is a type that describes a value
3150
3152
Contrary to [`ValueGen`](#valuegen), this type allows for specifying a union of strings that the StringGen should yield, as long as it is loosely typed as just `string`.
3151
3153
Use it in the [`consumeStringGen()`](#consumestringgen) function to convert the given StringGen value to a plain string. Also refer to that function for an example.
3152
3154
3155
+
<br>
3156
+
3157
+
### ListWithLength
3158
+
Represents a value that is either an array, NodeList, or any other object that has a numeric `length`, `count` or `size` property.
3159
+
Iterables are not included because they don't have a length property. They need to be converted to an array first using `Array.from()` or `[...iterable]`.
3160
+
3161
+
<details><summary><b>Example - click to view</b></summary>
0 commit comments