1515 * limitations under the License.
1616 */
1717
18- import { FieldPath } from '../lite-api/field_path' ;
19- import { Timestamp } from '../lite-api/timestamp' ;
2018
2119/**
2220 * Validates that 'value' is a string.
@@ -51,18 +49,6 @@ export function invalidArgumentMessage(
5149 return `${ formatArgumentName ( arg ) } is not a valid ${ expectedType } .` ;
5250}
5351
54- /**
55- * Formats the given word as plural conditionally given the preceding number.
56- *
57- * @private
58- * @internal
59- * @param num The number to use for formatting.
60- * @param str The string to format.
61- */
62- function formatPlural ( num : number , str : string ) : string {
63- return `${ num } ${ str } ` + ( num === 1 ? '' : 's' ) ;
64- }
65-
6652/**
6753 * Creates a descriptive name for the provided argument name or index.
6854 *
@@ -76,49 +62,3 @@ function formatArgumentName(arg: string | number): string {
7662 ? `Value for argument "${ arg } "`
7763 : `Element at index ${ arg } ` ;
7864}
79-
80- /**
81- * Verifies that 'args' has at least 'minSize' elements.
82- *
83- * @private
84- * @internal
85- * @param funcName The function name to use in the error message.
86- * @param args The array (or array-like structure) to verify.
87- * @param minSize The minimum number of elements to enforce.
88- * @throws if the expectation is not met.
89- */
90- export function validateMinNumberOfArguments (
91- funcName : string ,
92- args : IArguments | unknown [ ] ,
93- minSize : number
94- ) : void {
95- if ( args . length < minSize ) {
96- throw new Error (
97- `Function "${ funcName } ()" requires at least ` +
98- `${ formatPlural ( minSize , 'argument' ) } .`
99- ) ;
100- }
101- }
102-
103- /**
104- * Verifies that 'args' has at most 'maxSize' elements.
105- *
106- * @private
107- * @internal
108- * @param funcName The function name to use in the error message.
109- * @param args The array (or array-like structure) to verify.
110- * @param maxSize The maximum number of elements to enforce.
111- * @throws if the expectation is not met.
112- */
113- export function validateMaxNumberOfArguments (
114- funcName : string ,
115- args : IArguments ,
116- maxSize : number
117- ) : void {
118- if ( args . length > maxSize ) {
119- throw new Error (
120- `Function "${ funcName } ()" accepts at most ` +
121- `${ formatPlural ( maxSize , 'argument' ) } .`
122- ) ;
123- }
124- }
0 commit comments