1- /* eslint-disable new-cap */
21import Cartesian3 from "./Cartesian3.js" ;
32import Cartographic from "./Cartographic.js" ;
43import Check from "./Check.js" ;
@@ -209,15 +208,12 @@ S2Cell.isValidId = function (cellId) {
209208 }
210209
211210 // Check if face bits indicate a valid value, in range [0-5].
212- // eslint-disable-next-line
213211 if ( cellId >> BigInt ( S2_POSITION_BITS ) > 5 ) {
214212 return false ;
215213 }
216214
217215 // Check trailing 1 bit is in one of the even bit positions allowed for the 30 levels, using a bitmask.
218- // eslint-disable-next-line no-undef
219216 const lowestSetBit = cellId & ( ~ cellId + BigInt ( 1 ) ) ;
220- // eslint-disable-next-line
221217 if ( ! ( lowestSetBit & BigInt ( "0x1555555555555555" ) ) ) {
222218 return false ;
223219 }
@@ -296,14 +292,12 @@ S2Cell.getLevel = function (cellId) {
296292 //>>includeEnd('debug');
297293
298294 let lsbPosition = 0 ;
299- // eslint-disable-next-line
300295 while ( cellId !== BigInt ( 0 ) ) {
301- // eslint-disable-next-line
302296 if ( cellId & BigInt ( 1 ) ) {
303297 break ;
304298 }
305299 lsbPosition ++ ;
306- cellId = cellId >> BigInt ( 1 ) ; // eslint-disable-line
300+ cellId = cellId >> BigInt ( 1 ) ;
307301 }
308302
309303 // We use (>> 1) because there are 2 bits per level.
@@ -329,10 +323,8 @@ S2Cell.prototype.getChild = function (index) {
329323 //>>includeEnd('debug');
330324
331325 // Shift sentinel bit 2 positions to the right.
332- // eslint-disable-next-line no-undef
333326 const newLsb = lsb ( this . _cellId ) >> BigInt ( 2 ) ;
334327 // Insert child index before the sentinel bit.
335- // eslint-disable-next-line no-undef
336328 const childCellId = this . _cellId + BigInt ( 2 * index + 1 - 4 ) * newLsb ;
337329 return new S2Cell ( childCellId ) ;
338330} ;
@@ -350,10 +342,8 @@ S2Cell.prototype.getParent = function () {
350342 }
351343 //>>includeEnd('debug');
352344 // Shift the sentinel bit 2 positions to the left.
353- // eslint-disable-next-line no-undef
354345 const newLsb = lsb ( this . _cellId ) << BigInt ( 2 ) ;
355346 // Erase the left over bits to the right of the sentinel bit.
356- // eslint-disable-next-line no-undef
357347 return new S2Cell ( ( this . _cellId & ( ~ newLsb + BigInt ( 1 ) ) ) | newLsb ) ;
358348} ;
359349
@@ -455,7 +445,6 @@ S2Cell.fromFacePositionLevel = function (face, position, level) {
455445 ) . join ( "0" ) ;
456446 const positionSuffixPadding = Array ( S2_POSITION_BITS - 2 * level ) . join ( "0" ) ;
457447
458- // eslint-disable-next-line no-undef
459448 const cellId = BigInt (
460449 `0b${ faceBitString } ${ positionPrefixPadding } ${ positionBitString } 1${
461450 // Adding the sentinel bit that always follows the position bits.
@@ -500,7 +489,7 @@ function convertCellIdToFaceSiTi(cellId, level) {
500489 // that represent the parent cell center.
501490 const isLeaf = level === 30 ;
502491 const shouldCorrect =
503- ! isLeaf && ( BigInt ( i ) ^ ( cellId >> BigInt ( 2 ) ) ) & BigInt ( 1 ) ; // eslint-disable-line
492+ ! isLeaf && ( BigInt ( i ) ^ ( cellId >> BigInt ( 2 ) ) ) & BigInt ( 1 ) ;
504493 const correction = isLeaf ? 1 : shouldCorrect ? 2 : 0 ;
505494 const si = ( i << 1 ) + correction ;
506495 const ti = ( j << 1 ) + correction ;
@@ -515,7 +504,6 @@ function convertCellIdToFaceIJ(cellId) {
515504 generateLookupTable ( ) ;
516505 }
517506
518- // eslint-disable-next-line no-undef
519507 const face = Number ( cellId >> BigInt ( S2_POSITION_BITS ) ) ;
520508 let bits = face & S2_SWAP_MASK ;
521509 const lookupMask = ( 1 << S2_LOOKUP_BITS ) - 1 ;
@@ -529,7 +517,7 @@ function convertCellIdToFaceIJ(cellId) {
529517 const extractMask = ( 1 << ( 2 * numberOfBits ) ) - 1 ;
530518 bits +=
531519 Number (
532- ( cellId >> BigInt ( k * 2 * S2_LOOKUP_BITS + 1 ) ) & BigInt ( extractMask ) , // eslint-disable-line
520+ ( cellId >> BigInt ( k * 2 * S2_LOOKUP_BITS + 1 ) ) & BigInt ( extractMask ) ,
533521 ) << 2 ;
534522
535523 bits = S2_LOOKUP_IJ [ bits ] ;
@@ -715,15 +703,15 @@ function generateLookupTable() {
715703 * @private
716704 */
717705function lsb ( cellId ) {
718- return cellId & ( ~ cellId + BigInt ( 1 ) ) ; // eslint-disable-line
706+ return cellId & ( ~ cellId + BigInt ( 1 ) ) ;
719707}
720708
721709/**
722710 * Return the lowest-numbered bit that is on for cells at the given level.
723711 * @private
724712 */
725713function lsbForLevel ( level ) {
726- return BigInt ( 1 ) << BigInt ( 2 * ( S2_MAX_LEVEL - level ) ) ; // eslint-disable-line
714+ return BigInt ( 1 ) << BigInt ( 2 * ( S2_MAX_LEVEL - level ) ) ;
727715}
728716
729717// Lookup table for getting trailing zero bits.
@@ -740,7 +728,7 @@ const Mod67BitPosition = [
740728 * @private
741729 */
742730function countTrailingZeroBits ( x ) {
743- return Mod67BitPosition [ ( - x & x ) % BigInt ( 67 ) ] ; // eslint-disable-line
731+ return Mod67BitPosition [ ( - x & x ) % BigInt ( 67 ) ] ;
744732}
745733
746734export default S2Cell ;
0 commit comments