lib/tle.js
function( value ) {

    var lines = TLE.trim( value + '' ).split( /\r?\n/g )
    var line, checksum

    // Line 0
    if (lines.length === 3) {
      this.name = TLE.trim( lines.shift() )
    }

    // Line 1
    line = lines.shift()
    checksum = TLE.check( line )

    if( checksum != line.substring( 68, 69 ) ) {
      throw new Error(
        'Line 1 checksum mismatch: ' + checksum + ' != ' +
        line.substring( 68, 69 ) + ': ' + line
      )
    }

    this.number = TLE.parseFloat( line.substring( 2, 7 ) )
    this.class = TLE.trim( line.substring( 7, 9 ) )
    this.id = TLE.trim( line.substring( 9, 18 ) )
    this.date = TLE.parseDate( line.substring( 18, 33 ) )
    this.fdmm = TLE.parseFloat( line.substring( 33, 44 ) )
    this.sdmm = TLE.parseFloat( line.substring( 44, 53 ) )
    this.drag = TLE.parseDrag( line.substring( 53, 62 ) )
    this.ephemeris = TLE.parseFloat( line.substring( 62, 64 ) )
    this.esn = TLE.parseFloat( line.substring( 64, 68 ) )

    // Line 2
    line = lines.shift()
    checksum = TLE.check( line )

    if( checksum != line.substring( 68, 69 ) ) {
      throw new Error(
        'Line 2 checksum mismatch: ' + checksum + ' != ' +
        line.substring( 68, 69 ) + ': ' + line
      )
    }

    this.inclination = TLE.parseFloat( line.substring( 8, 17 ) )
    this.ascension = TLE.parseFloat( line.substring( 17, 26 ) )
    this.eccentricity = TLE.parseFloat( '0.' + line.substring( 26, 34 ) )
    this.perigee = TLE.parseFloat( line.substring( 34, 43 ) )
    this.anomaly = TLE.parseFloat( line.substring( 43, 52 ) )
    this.motion = TLE.parseFloat( line.substring( 52, 64 ) )
    this.revolution = TLE.parseFloat( line.substring( 64, 68 ) )

    return this

  }
function( value ) {

    var lines = TLE.trim( value + '' ).split( /\r?\n/g )
    var line, checksum

    // Line 0
    if (lines.length === 3) {
      this.name = TLE.trim( lines.shift() )
    }

    // Line 1
    line = lines.shift()
    checksum = TLE.check( line )

    if( checksum != line.substring( 68, 69 ) ) {
      throw new Error(
        'Line 1 checksum mismatch: ' + checksum + ' != ' +
        line.substring( 68, 69 ) + ': ' + line
      )
    }

    this.number = TLE.parseFloat( line.substring( 2, 7 ) )
    this.class = TLE.trim( line.substring( 7, 9 ) )
    this.id = TLE.trim( line.substring( 9, 18 ) )
    this.date = TLE.parseDate( line.substring( 18, 33 ) )
    this.fdmm = TLE.parseFloat( line.substring( 33, 44 ) )
    this.sdmm = TLE.parseFloat( line.substring( 44, 53 ) )
    this.drag = TLE.parseDrag( line.substring( 53, 62 ) )
    this.ephemeris = TLE.parseFloat( line.substring( 62, 64 ) )
    this.esn = TLE.parseFloat( line.substring( 64, 68 ) )

    // Line 2
    line = lines.shift()
    checksum = TLE.check( line )

    if( checksum != line.substring( 68, 69 ) ) {
      throw new Error(
        'Line 2 checksum mismatch: ' + checksum + ' != ' +
        line.substring( 68, 69 ) + ': ' + line
      )
    }

    this.inclination = TLE.parseFloat( line.substring( 8, 17 ) )
    this.ascension = TLE.parseFloat( line.substring( 17, 26 ) )
    this.eccentricity = TLE.parseFloat( '0.' + line.substring( 26, 34 ) )
    this.perigee = TLE.parseFloat( line.substring( 34, 43 ) )
    this.anomaly = TLE.parseFloat( line.substring( 43, 52 ) )
    this.motion = TLE.parseFloat( line.substring( 52, 64 ) )
    this.revolution = TLE.parseFloat( line.substring( 64, 68 ) )

    return this

  }
function ( value ) { var lines = TLE . trim ( value + '' ) . split ( / \r?\n / g ) var line , checksum // Line 0 if ( lines . length === 3 ) { this . name = TLE . trim ( lines . shift ( ) ) } // Line 1 line = lines . shift ( ) checksum = TLE . check ( line ) if ( checksum != line . substring ( 68 , 69 ) ) { throw new Error ( 'Line 1 checksum mismatch: ' + checksum + ' != ' + line . substring ( 68 , 69 ) + ': ' + line ) } this . number = TLE . parseFloat ( line . substring ( 2 , 7 ) ) this . class = TLE . trim ( line . substring ( 7 , 9 ) ) this . id = TLE . trim ( line . substring ( 9 , 18 ) ) this . date = TLE . parseDate ( line . substring ( 18 , 33 ) ) this . fdmm = TLE . parseFloat ( line . substring ( 33 , 44 ) ) this . sdmm = TLE . parseFloat ( line . substring ( 44 , 53 ) ) this . drag = TLE . parseDrag ( line . substring ( 53 , 62 ) ) this . ephemeris = TLE . parseFloat ( line . substring ( 62 , 64 ) ) this . esn = TLE . parseFloat ( line . substring ( 64 , 68 ) ) // Line 2 line = lines . shift ( ) checksum = TLE . check ( line ) if ( checksum != line . substring ( 68 , 69 ) ) { throw new Error ( 'Line 2 checksum mismatch: ' + checksum + ' != ' + line . substring ( 68 , 69 ) + ': ' + line ) } this . inclination = TLE . parseFloat ( line . substring ( 8 , 17 ) ) this . ascension = TLE . parseFloat ( line . substring ( 17 , 26 ) ) this . eccentricity = TLE . parseFloat ( '0.' + line . substring ( 26 , 34 ) ) this . perigee = TLE . parseFloat ( line . substring ( 34 , 43 ) ) this . anomaly = TLE . parseFloat ( line . substring ( 43 , 52 ) ) this . motion = TLE . parseFloat ( line . substring ( 52 , 64 ) ) this . revolution = TLE . parseFloat ( line . substring ( 64 , 68 ) ) return this }
Parse a TLE's string representation
@param  {String} value
@return {TLE}
Parse a TLE s string representation