Lines Matching refs:index

129  * Ensures that `index` specifies a valid position in an indexable object of
130 * size `size`. A position index may range from zero to size, inclusive.
131 * @param {number} index
133 * @throws {!Error} If the index is out of range and the check state is debug.
135 function checkPositionIndex(index, size) {
139 checkCriticalPositionIndex(index, size);
143 * Ensures that `index` specifies a valid position in an indexable object of
144 * size `size`. A position index may range from zero to size, inclusive.
145 * @param {number} index
147 * @throws {!Error} If the index is out of range and the check state is
150 function checkCriticalPositionIndex(index, size) {
154 if (index < 0 || index > size) {
155 throw new Error(`Index out of bounds: index: ${index} size: ${size}`);
160 * Ensures that `index` specifies a valid element in an indexable object of
161 * size `size`. A element index may range from zero to size, exclusive.
162 * @param {number} index
164 * @throws {!Error} If the index is out of range and the check state is
167 function checkElementIndex(index, size) {
171 checkCriticalElementIndex(index, size);
175 * Ensures that `index` specifies a valid element in an indexable object of
176 * size `size`. A element index may range from zero to size, exclusive.
177 * @param {number} index
179 * @throws {!Error} If the index is out of range and the check state is
182 function checkCriticalElementIndex(index, size) {
186 if (index < 0 || index >= size) {
187 throw new Error(`Index out of bounds: index: ${index} size: ${size}`);